dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

"hh:mm" incorrectly jumps 24 hours ahead when date in localtime is ahead of UTC date (eg New Zealand)

Open davidmcnabnz opened this issue 3 years ago • 1 comments

Severe issue where parseDate("hh:mm") in some circumstances jumps one day ahead of where it should.

I'm in New Zealand (UTC+12). At 2021-06-04 19:30 +00:00:00 (UTC), the local datetime in New Zealand is 2021-06-05 07:30:00.

At this time, when I call:

  • parseDate("19:40") I get:
  • datetime.datetime(2021, 6, 5, 19, 40)

However, last night when I used it (when the date in NZ was same as UTC - 2021-06-04), this "24 hours in the future" behaviour does not occur.

The bug only seems to happen when the localtime date in New Zealand is a day ahead of the UTC date. For New Zealand, this is between 12:00:00-23:59:59 UTC, or between 00:00:00-11:59:59 NZST.

Fix would be to test if localtime date is ahead of UTC date, and if so, adjust accordingly.

davidmcnabnz avatar Jun 04 '21 19:06 davidmcnabnz

Hmmm.. that's interesting. I think we have some issues that could be exaplained with this. :thinking:

I will try to take a look :)

noviluni avatar Jul 24 '21 14:07 noviluni