sobhagya-sahu / datejs

Automatically exported from code.google.com/p/datejs
0 stars 0 forks source link

Timezone adjustments are backwards #99

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When changing timezones, as you go west through the timezones the hours
progress further in the day when they should go back. See the attached code
for an example.

In the attached code you would expect Pacific time to be 1:00, Mountain to
be 2:00, Central to be 3:00, Eastern is 4:00 but the actual result is
Pacific time is 4:00, Mountain is 3:00, Central is 2:00 and Eastern is
1:00. This is backwards.

I am using:

 * Version: 1.0 Alpha-1 
 * Build Date: 13-Nov-2007

On Mac OS X 10.5.8 using Firefox 3.6

I was able to fix the issue by changing the following lines in core.js
(620-623)

    $P.setTimezoneOffset = function (offset) {
        var here = this.getTimezoneOffset(), there = Number(offset) * -6 / 10;
        return this.addMinutes(there - here); 
    };

to

    $P.setTimezoneOffset = function (offset) {
        var here = this.getTimezoneOffset(), there = Number(offset) * -6 / 10;
        return this.addMinutes(here - there); 
    };

I reversed the variables here and there.

Original issue reported on code.google.com by e...@ericfaerber.com on 16 Mar 2010 at 7:11

Attachments:

GoogleCodeExporter commented 8 years ago
fixed in my current fork: https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 15 Sep 2013 at 12:53