Closed Bug 388735 Opened 18 years ago Closed 18 years ago

GData Provider creates events off by one hour for timezones with fractional offsets

Categories

(Calendar :: Provider: GData, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: chromic, Assigned: chromic)

References

Details

(Whiteboard: [gdata-0.3])

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20070226 BonEcho/2.0.0.1 Build Identifier: 0.2.1 Creating an event on a Google Calendar when the timezone is set to (for eg) Asia/Calcutta (offset 05:30) causes the event to jump up by an hour when it gets saved. Reproducible: Always Steps to Reproduce: 1. Create a google calendar, set the timezone to Asia/Calcutta 2. Add this calendar to Lightning via GData provider 3. Make sure Lightning timezone is also set to Asia/Calcutta 4. Create an event by clicking (say) at 9:00 AM and dragging to 10:00 AM. 5. Wait for a few seconds for the event to be saved to the server The event will "jump" up to 8:00 AM-9:00 AM. Actual Results: The event jumped up to 8:00 AM-9:00 AM. In addition, each time you update the event, it will move up by 1 hour Expected Results: Event should stay at 9:00 AM.
The problem seems to be because of the following line in calGoogleUtils.js: var tzoffset_hr = (aDateTime.timezoneOffset / 3600).toFixed(0); This line is trying to extract the "hour" component of the timezone offset given in seconds. Since Number.toFixed() *rounds* rather than truncates, a timezone of 5:30 will have a tzoffset_hr of 6, which is obviously wrong. Changing the above line to use Math.floor() fixes the problem : var tzoffset_hr = Math.floor(aDateTime.timezoneOffset / 3600);
Added a patch to demonstrate
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
OS: Linux → All
Hardware: PC → All
Whiteboard: [gdata-0.2.2]
Assignee: nobody → chromic
Status: ASSIGNED → NEW
Comment on attachment 272920 [details] [diff] [review] Change Number.fixed() to Math.floor() Thanks for catching this, many people with half hour timezones will be happy about this! I'll check this in for version 0.2.2 which should be out pretty soon. If you decide to do further patches, please read the guidelines on creating a patch (http://developer.mozilla.org/en/docs/Creating_a_patch). You don't need to create a new patch here though. r=philipp
Attachment #272920 - Flags: review+
Checked in on HEAD and MOZILLA_1_8_BRANCH -> FIXED
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Thanks. I'll make sure to follow the patch creation process next time.
Whiteboard: [gdata-0.2.2] → [gdata-0.3]
I just recently installed Thunderbird, Sunbird, Lightning, and GCal and am experiencing this problem exactly as described in the first bugnote. Everytime the item gets saved, it moves it an hour later. I am using: Thunderbird 2.0.0.9 Sunbird 0.7 Lightning 0.7 GCal 0.3.1
I forgot to mention, but I am in the -0330 timezone (Newfoundland)
Did your timezone recently change? Please try with Calendar 0.8pre and a nightly from http://gdataprovider.mozdev.org/ Enable calendar.debug.log in your advanced config editor, and take a look at the XML uploaded and the item returned. If you give me a copy of the xml uploaded, I can debug this manually.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: