mde / timezone-js

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

Altering date doesn't work -- example code #25

Closed davidmarble closed 12 years ago

davidmarble commented 12 years ago

I'm guessing setAttribute and/or timezoneJS.Date constructor needs some work. The following merely adds 1 day to a timezone-aware date, but the hours get messed up in the process.

var dt = new timezoneJS.Date();
dt.setTimezone('America/New_York');
x = dt.hours;
dt.setDate(dt.getDate() + 1);
y = dt.hours;
alert(x===y);

Is this related to the other issue I added regarding tzInfo not being copied to cloned dates?