Closed mhrivnak closed 12 years ago
This needs a test. As much as it pains me to commit without a test and abandon this issue, I must work on UI code as much as possible right now. However, we definitely won't commit a release to the master branch until all issues like this have received satisfactory tests.
Is there any particular reason why this is not applied to exact
, greater_than_or_equal
and less_than_or_equal
as well?
The date created in handle_endpoint
also needs to have tzinfo set to properly compare the dates. I'll take care of it.
As a side note: Is there any reason why this isnt done always in pr_time.iso8601_to_datetime?
No reason at all. Feel free to add them. I was just adding the ones I needed for the UI.
On Sat, Jan 28, 2012 at 7:31 PM, John O'Connor reply@reply.github.com wrote:
Is there any particular reason why this is not applied to
greater_than_or_equal
andless_than_or_equal
as well?
Might as well for the sake of completion.
I think that when tzinfo is None, that means UTC. The final return value is a product of calling datetime.utcfromtimestamp(), which as you can imagine, is designed to always return a datetime in UTC.
http://docs.python.org/library/datetime.html#datetime.datetime.utcfromtimestamp
On Sat, Jan 28, 2012 at 7:47 PM, John O'Connor reply@reply.github.com wrote:
The date created in
handle_endpoint
also needs to have tzinfo set to properly compare the dates. I'll take care of it.As a side note: Is there any reason why this isnt done always in pr_time.iso8601_to_datetime?
Right but the problem occurs when compared to dates with tzinfo=pr_time.UTC(). If you want to see what I mean checkout issue/77 and run the pr_services.TestGetFiltered with and without commit dc94678681797da5ee9a4001ad8940faec535d94 present.
I created a separate issue #90 for the date consistency issue.
For now the date created in the filter uses the pr_time.UTC class which is sufficient for this issue.
This is now merged into dev.
Currently, the only way to use dates in a get_filtered() call is by defining a date range. We also need to use dates with "greater_than", specifically so we can get all BlackoutPeriod objects that occur in the future.
While we're at it, it will probably be trivial to implement this for "less_than" as well.