mde / timezone-js

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

Very unexpected result #107

Closed staeke closed 4 years ago

staeke commented 11 years ago

I'm in Sweden running the following (with printouts)

(new timezoneJS.Date("2013-09-24", "America/Los_Angeles")).toISOString() "2013-09-24T09:00:00.000Z" Comment: Very wrong and weird. Should be "2013-09-24T07:00:00.000Z"

(new timezoneJS.Date("2013-09-24 00:00", "America/Los_Angeles")).toISOString() "2013-09-24T07:00:00.000Z" Comment: Correct

(new timezoneJS.Date("2013-09-24Z", "America/Los_Angeles")).toISOString() "2013-09-24T00:00:00.000Z" Comment: According to docs, the timezone should be used when passed. But it isn't now. Thus this seems an error. Should be "2013-09-24T07:00:00.000Z"

(new timezoneJS.Date("2013-09-24 ", "America/Los_Angeles")).toISOString() "2013-09-24T07:00:00.000Z" Comment: Correct. But why is this different to the first case??

longlho commented 11 years ago

We currently use Date.parse to parse the 1st string param and there's definitely an issue there especially when it has timezone in the string itself. It also behaves differently depending on browsers. We're trying to take a look into it.