• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSCalendar bug with adding to pre-1919 dates?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSCalendar bug with adding to pre-1919 dates?


  • Subject: NSCalendar bug with adding to pre-1919 dates?
  • From: Ben Kazez <email@hidden>
  • Date: Tue, 28 Feb 2006 17:06:22 -0600

I have an application that retrieves an NSCalendarDate from a .ics file and adds one year to it until the date is within a certain range. (This isn't the most efficient way to do things, but it's fast enough for my needs.) This algorithm runs into a problem with dates before 1919. Here's the line that adds the date components:

currentExpandedDate = [[IEPSystemCalendar dateByAddingComponents:frequency toDate:currentExpandedDate options: 0] dateWithCalendarFormat:BKWebScriptCalendarFormat timeZone: [[unexpandedEvent objectForKey:@"DTSTART"] timeZone]];

The frequency variable is set to one year using -[NSDateComponents setYear:]. As an example, here the app is starting with 1914-03-01 00:00:00 -0600:

March 01, 1915 00:00:00
March 01, 1916 00:00:00
March 01, 1917 00:00:00
March 01, 1918 00:00:00
March 01, 1919 01:00:00
March 01, 1920 01:00:00
...

(Sorry for the inconsistent date formatting.) As you can see, after 1918, the date is one hour off. Does anyone know why this is happening?

Ben
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSCalendar bug with adding to pre-1919 dates?
      • From: Brett Powley <email@hidden>
    • Re: NSCalendar bug with adding to pre-1919 dates?
      • From: Ryan Britton <email@hidden>
  • Prev by Date: NSPopUpButton - aligning to top vertically
  • Next by Date: Re: Problems with NSGraphicsContext
  • Previous by thread: NSPopUpButton - aligning to top vertically
  • Next by thread: Re: NSCalendar bug with adding to pre-1919 dates?
  • Index(es):
    • Date
    • Thread