New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time.Date() incorrect for Jan 31, 2010 19:00 GMT #28
Comments
I can reproduce this bug with local timezone set to "America/Los_Angeles". |
Looks like this particular bug may have something to do with dates on the 31st of the month - this one also incorrectly gives March 1st...
|
I found a workaround that seems to work for my needs so far. If I create a standard JavaScript Date object with the correct year, month, day, hour, and minute, then create a new time.Date from the standard JavaScript Date, all of the timezone manipulations seem to work as expected. I will obviously need to do more testing but it's looking promising at the moment.
|
I am getting this issue as well Unfortunately I can't find a work around for my issue using this library. I am going from Australia/Sydney (or any other generic timezone) to UTC, and not vice versa. This means I cant use the Date.UTC (or normal Date functions) as they will be in the incorrect timezone (UTC) and it defeats the purpose of using this library |
Hi. I think I've fixed the problem you are having. This patch should produce correct results even on the last days of a month, and also when going back to UTC with setTimezone, both forwards and backwards. Tests are included, but please try this on your code too. |
Fixes #28: Incorrect timezone calculation on edge of months.
Fixed in the |
Sorry about the wait guys! |
Actually this fix created inverse problem: > new time.Date(2013,02,01,00,00,"US/Eastern")
{ Fri, 01 Mar 2013 05:00:00 GMT |
@blax: strange, I thought I did test that too. I guess operating differently according to the day of month is too hacky, but it could work as a quick fix. |
I've noticed it strongly depends on your local system TimeZone and tests seem to not take it into consideration at all. |
The following line seems to be returning "Sun Jan 03 2010 19:00:00 GMT+0000 (UTC)"
I think this should be returning "Sun Jan 31..." instead. I really appreciate the help with this - if I'm missing something, I'm sure not seeing it.
Thanks,
-Dan
The code I need looks a little more like this but I can't seem to get the hard-coded values to work so that seems like the place to start.
The text was updated successfully, but these errors were encountered: