mde / timezone-js

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

timezoneJS constructor returns wrong offset and timezone #178

Closed avinsrid closed 4 years ago

avinsrid commented 8 years ago

Hi,

Here is a simple example of why this constructor fails when we pass in the timezone argument:

new timezoneJS.Date('Asia/Kolkata') t…S.Date {_useCache: false, _tzInfo: Object, _day: 4, year: 2016, month: 1…}_dateProxy: Thu Feb 11 2016 00:45:41 GMT-0500 (Eastern Standard Time)proto: Date_day: 4_timeProxy: 1455151541179_tzInfo: Object_useCache: falsedate: 11hours: 0milliseconds: 179minutes: 45month: 1seconds: 41timezone: "Asia/Kolkata"year: 2016proto: Object

The time is correct, but it still tells Eastern Standard Time and GMT -0500

Same is when we enter 'Etc/UTC' argument, we get the following:

new timezoneJS.Date('Etc/UTC') _dateProxy: Wed Feb 10 2016 19:19:09 GMT-0500 (Eastern Standard Time)

It would be great if someone could correct what I am doing here.

~Avinash

mde commented 4 years ago

This library is no longer maintained, and this repo is here only for historical interest.