captbaritone / captbaritone/datejs

Timezone adjustments are backwards

Open
#99 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
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:
- [index.html](https://storage.googleapis.com/google-code-attachments/datejs/issue-99/comment-0/index.html)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.