bugGNUstep - Bugs: bug #18088, -[NSCalendarDate...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #18088: -[NSCalendarDate dateByAddingYears:months:days:hours:minutes:seconds:] doesn't handle month boundries as expected

Submitted by:  David Ayers <ayers>
Submitted on:  Mon 23 Oct 2006 10:42:16 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 23 Oct 2006 02:03:10 PM UTC, comment #4:

Of course, thanks a lot!

David Ayers <ayers>
Project Member
Mon 23 Oct 2006 01:42:05 PM UTC, comment #3:

I think you will find that the timezones of both objects are the same.
You are probably being confused by the fact that different timezone offsets are being reported ... that's because the two times are in different daylight savings time periods, not because they are in different timezones.

Richard Frith-Macdonald <CaS>
Project Member
Mon 23 Oct 2006 01:21:28 PM UTC, comment #2:

Almost I believe...
The time zones differ:

before the calculation: 2006-10-01 00:00:00 +0100
after the calculation: 2006-11-01 02:10:00 +0000

Yet the time zones aren't being tested.

David Ayers <ayers>
Project Member
Mon 23 Oct 2006 12:28:42 PM UTC, comment #1:

This should be fixed now ... by working (calculating the new value from the supplied offsets) in the timezone of the calendar date rather than in GMT.
The new code appears to work for all existing cases in the testsuite ... but you may want to test it for other cases.

Richard Frith-Macdonald <CaS>
Project Member
Mon 23 Oct 2006 10:42:16 AM UTC, original submission:

(see: testsuite/base/NSCalendarDate/test00.m)

date: 2006-10-01 00:00:00 +0100
dateByAddingYears: 0 months: 1 days: 0
hours: 2 minutes: 10 seconds: 0
expected result
date: 2006-11-01 02:10:00 +0100
actual result
date: 2006-10-31 02:10:00 +0000

What happens conceptually is...
the date is "normalized" to GMT:
2006-09-30 23:00:00 +0000

the month is added:
2006-10-30 23:00:00 +0000

the hours are added:
2006-10-30 25:00:00 +0000
2006-10-31 01:00:00 +0000

the minutes are added:
2006-10-31 01:10:00 +0000

the time zone offset is added:
2006-10-31 02:10:00 +0000

So there are actually two issues.

1) basing the calculation on GMT is giving unexpected results in cases when month boundries are crossed.
2) the time zone is not preserved.

I'm not sure what the correct approach to fixing this is.

David Ayers <ayers>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Mon 23 Oct 2006 02:03:10 PM UTCayersOpen/ClosedIn Test=>Closed
Mon 23 Oct 2006 12:28:42 PM UTCCaSStatusNone=>Fixed
  Open/ClosedOpen=>In Test

Back to the top


Powered by Savane 3.1-cleanup1