Skip to content

Accept use of relative date literals as time values

John Hope requested to merge poc_allow_barewords_for_functions into main

Fixes #26 (closed)

Adds relative date literals to the language.

Now, instead of doing:

  • created > startOfDay("-7")

You can do:

  • created > -7d

It also allows to work with other time-spans than just days.

The following denominators are supported:

  • d for days
  • w for weeks
  • y for years (always 365 days)

This provides the first example of something resembling "bare words" in the parser. This could provide a basis for the implementation of Implement ISO date literal (yyyy-mm-dd) (#27 - closed) also.

Why not months?

Months are tricky both in implementation and meaning. What does it mean to subtract 1 month from the 31st May? 30th April? 1st May?

For %0.0.5 I think it's fine to omit months and anything at a lower resolution than one day.

Edited by John Hope

Merge request reports