-
Notifications
You must be signed in to change notification settings - Fork 7
Description
The test specifies the following CQL:
DateTime(2016,5) - 31535999 seconds = DateTime(2015, 5)
and expected outcome true.
This is tricky because the CQL spec says:
For partial date/time values where the time-valued quantity is more precise than the partial date/time, the operation is performed by converting the time-based quantity to the most precise value specified in the first argument (truncating any resulting decimal portion) and then subtracting it from the first argument.
It's not clear how to convert seconds into months. If we convert 31535999 seconds to months using UCUM units, we get 11.991786. If we then truncate the decimal portion (as the spec suggests) and subtract, we end up with DateTime(2015, 6), not DateTime(2015, 5). Translating seconds to days still comes in at 364.99999, which is less than a year, and therefore less than 12 months (landing on DateTime(2015, 6)).
So... although DateTime(2016,5) - 31535999 seconds is almost DateTime(2015, 5), it's not quite that. It would probably be best to either increase the seconds to 31557600 or fix the test to expect DateTime(2015,6). (Or tell me how engines should be doing this calculation to arrive at DateTime(2015, 5)).