TryGhost / NQL

MIT License
4 stars 8 forks source link

Ensure that date & relative date comparisons work in a consistent way across JSON, SQLite and MySQL #28

Open ErisDS opened 2 years ago

ErisDS commented 2 years ago

NQL date handling is in an unmanageable state.

We have to manage across the following variables:

  1. get helpers, where the real use case looks like this: {{#get "posts" filter="published_at:<='{{published_at}}'+id:-{{id}}" limit="3"}} this means it depends what comes out of the API as to what goes back in... ref: https://ghost.org/docs/themes/helpers/get/#filter
  2. Prev & Next helpers which are builtins that do essentially the same thing, but they enforce that the right format ref: https://github.com/TryGhost/Ghost/blob/1cc38733ba6df8b8340420cff8fc7b643704c6ae/core/frontend/helpers/prev_post.js#L21
  3. relative date queries like last_seen_at>now-1d ref: https://github.com/TryGhost/NQL/issues/26

We need to make sure that dates work consistently in these 3 cases.