mde / timezone-js

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.
824 stars 182 forks source link

setTimezone() should reset utc flag #14

Closed giulianob closed 12 years ago

giulianob commented 12 years ago

When calling setTimezone, the utc flag is set but never reset. This means that if we are to go from UTC to another timezone, other parts of the code will still think we are in UTC.

Simple fix is just to change setTimezone, replace the if statement with:

this.utc = tz === 'Etc/UTC' || tz === 'Etc/GMT';
longlho commented 12 years ago

I'll take a look at this. Feel free to pull request if u think this fixes it. Some unit tests would be great too

giulianob commented 12 years ago

It also looks like calling setTimezone then getTime will yield an invalid value. When setTimezone is called it should really reset all of the minutes, hours, etc.. vars.

On Thu, May 31, 2012 at 11:58 AM, Long Ho < reply@reply.github.com

wrote:

I'll take a look at this. Feel free to pull request if u think this fixes it. Some unit tests would be great too


Reply to this email directly or view it on GitHub: https://github.com/mde/timezone-js/issues/14#issuecomment-6039842

Giuliano Barberi