Closed Bug 305432 Opened 19 years ago Closed 16 years ago

setting nativeTime sets timezone to UTC

Categories

(Calendar :: Internal Components, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gekacheka, Assigned: dbo)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050820 CalendarItemDialog/0.1.0 Mozilla Sunbird/0.2+

setting nativeTime sets timezone to UTC
http://lxr.mozilla.org/mozilla/source/calendar/base/src/calDateTime.cpp#215

But interface says it should use the current timezone.
  "If nativeTime is set, the given UTC PRTime value is exploded into
   year/month/etc, taking into account the timezone setting."
http://lxr.mozilla.org/mozilla/source/calendar/base/public/calIDateTime.idl#72

Reproducible: Always




Workaround:  
  1. save old timezone: 
      tz = calDateTime.timezone.
  2. set nativeTime:  
      calDateTime.nativeTime = n;
      calDateTime.normalize();
  3. construct another calDateTime by calling 
      calDateTime = calDateTime.getInTimezone(tz);
Unfortunately, I do not have cycles to work on Calendar stuff these days (just as it's getting to the good part!), so I am a bad owner for these bugs.  To delete the tragically-large chunk of bugspam, search for gregorianabdication.
Assignee: shaver → nobody
Is this bug still valid?
Yes. But it is questionable if it should be fixed. It gives an easy way to delete DT/DST information from a date, as needed in bug 402841 and in bug 416206 for calculating offsets with discrete days. 

Changing the interface description to it's current behaviour would preserve the current code which uses nativeTime. Creating features out of unsolved bugs is generally bad so please examine this issue in detail here.
Daniel, what's your opinion on this issue?  Can we resolve this bug as WFM or should we actually fix it, or simply change the description in the interface?
IMO we should just document the current behavior, i.e. that it's enforcing UTC. BTW: What's meant with "the current timezone"? calendarDefaultTimezone() or the timezone that is already set at the object?
(In reply to comment #5)
> BTW: What's meant with "the current timezone"? calendarDefaultTimezone() or the
> timezone that is already set at the object?
> 
The timezone setting of the datetime object.
Flags: in-testsuite?
I think we should just properly document the current usage.
Assignee: nobody → daniel.boelzle
Attachment #345162 - Flags: review?(philipp)
Status: NEW → ASSIGNED
Keywords: qawanted
Comment on attachment 345162 [details] [diff] [review]
document the current usage

r=philipp
Attachment #345162 - Flags: review?(philipp) → review+
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/5893a5dcb678>

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0
These bugs are likely targeted at Lightning 1.0b1, not Lightning 1.0. If this change was done in error, please adjust the target milestone to its correct value. To filter on this bugspam, you can use "lightning-10-target-move".
Target Milestone: 1.0 → 1.0b1
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: