Skip to content

Conversation

@qingfx
Copy link
Contributor

@qingfx qingfx commented Mar 18, 2016

The issue is caused by different assumptions about current Date object's timezone. Such assumption should not be made within timezoneAdjust as it does not know where the Date object comes from.
For one case, if the Date object is passed in by 'getDate', the Date object has an implied timezone of current TP instance's timezone setting. However, timezoneAdjust would have incorrectly assumed that the Date object's actual timezone is held by date.getTimezoneOffset().

Another issue is that inside timezoneAdjust, the calculation for adjusting Date object is wrong. The minutes should first be adjusted to UTC timezone, by substracting offset; then the resulted minutes can be adjusted to toTimezone, by adding the offset.

The issue is caused by different assumptions about current Date object's timezone. Such assumption should not be made within timezoneAdjust as it does not know where the Date object comes from.
For one case, if the Date object is passed in by 'getDate', the Date object has an implied timezone of current TP instance's timezone setting. However, timezoneAdjust would have incorrectly assumed that the Date object's actual timezone is held by date.getTimezoneOffset().

Another issue is that inside timezoneAdjust, the calculation for adjusting Date object is wrong. The minutes should first be adjusted to UTC timezone, by substracting offset; then the resulted minutes can be adjusted to toTimezone, by adding the offset.
trentrichardson added a commit that referenced this pull request Mar 22, 2016
@trentrichardson trentrichardson merged commit 30277c2 into trentrichardson:dev Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants