Closed ef-end-y closed 9 months ago
Thx
But now another problem:
I have record with datetime value 2024-04-01T00:00:00.362726
and use filter range 2024-03-01T00:00:00 - 2024-04-01T00:00:00
(March report) and see this record but I shouldn't :)
In Django admin we can input time range 00:00:00 to 23:59:59 (or another time range) into text fields. The db-query does not consider the last second, since we do not take into account microseconds: WHERE "created_at" >= '''2024-02-13 00:00:00''' AND "created_at" <= '''2024-02-13 23:59:59.999999'''
For this case you can just use filter 00:00:00 to 00:00:00 +1day
@silentsokolov I would concur with @ShudelEV that this change introduces odd behaviour. Would it perhaps be better to add an option to have __lt
instead of __lte
on the upper bound?
Could the issue be with different databases, where working with microseconds is poorly supported?
I would argue there wasn't an issue here.
If I understand correctly, what this PR sought to address, namely that if we select an upper bound of 23:59:59
, this would not include, say, a later time of 23:59:59.250
-- isn't that just expected behaviour? If we did want to select that time too, we could just set the upper bound at 00:00:00
of the next day.
From that point of view, the change in this PR breaks expectations ever so slightly. Whatever end time you enter, you now always get almost an extra second on top?
Microseconds are optional. Use RANGEFILTERS_USE_FILTER_END_MICROSECOND
, default False
Thank you for making this change, super 🙏
About this line: shouldn't that be without the not
?
Fix >_<
In Django admin we can input time range 00:00:00 to 23:59:59 (or another time range) into text fields. The db-query does not consider the last second, since we do not take into account microseconds: WHERE "created_at" >= '''2024-02-13 00:00:00''' AND "created_at" <= '''2024-02-13 23:59:59.999999'''