[APE] Fix DATETIME format using serialize of DateTime #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The format was not well manage for the
DateTime
andTime
.We now apply the
iso8601
format toDateTime
andTime
and the caller is not obliged to format the dates when using CB ORM like that:Why ?
When building a select query containing a data param with time, example
When, the
@period_end
is anActiveSupport::TimeWithZone
, on interpollation time, it gives2024-01-31 23:59:59 +0100
Then, the query above yields a n1ql wih the following clause :
AND started_at >= '2024-01-01 00:00:00 +0100' AND started_at <= '2024-01-31 23:59:59 +0100'
Note the date formats in that clause.
However, the started_at MIGHT/MUST/SHOULD be formated differently, like this :
2024-01-31T13:00:00Z
Because of this format miss-match, all documents having a started_at at the last date of the period are missed by the query.
It seems that CB compares dates as strings, When I run this query:
select '2024-01-31T13:00:00Z' < '2024-01-31 23:59:59 +0100'
I get "$1": false Because the char T is grater than the char space