08-02-2023, 04:27 PM
For floats we have special objects like -inf (and +inf), and which are guaranteed to compare less than (and greater than) other numbers.
I need something similar for datetimes, is there any such thing? In-db ordering must work correctly with django queryset filters, and ideally it should be db-agnostic (but at the very least it must work with mysql and sqlite) and timezone-agnostic.
At the moment I'm using null/`None`, but it is creating very messy queries because `None` is doing the job of *both* -inf and +inf and I have to explicitly account for all those cases in the queries.
I need something similar for datetimes, is there any such thing? In-db ordering must work correctly with django queryset filters, and ideally it should be db-agnostic (but at the very least it must work with mysql and sqlite) and timezone-agnostic.
At the moment I'm using null/`None`, but it is creating very messy queries because `None` is doing the job of *both* -inf and +inf and I have to explicitly account for all those cases in the queries.