discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCalendarDate problem


From: Andreas Hoeschler
Subject: Re: NSCalendarDate problem
Date: Thu, 3 Jul 2003 21:24:53 +0200

Hello Richard,

GNUstep is obviously trying to be tolerant of programmer errors, and restrict the arguments to the valid range. What behavior are you expecting? Do you know if MacOS-X causes an exception to be raised or the object to be deallocated and nil returned? The OpenStep spec and MacOS-X documentation don't specify the behavior, so technically there's nothing wrong with the current behavior.

Imagine you have an interface with a field where users are supposed to enter times. I have specified the format %H:%M. NSCalendarDate is to be used to hold the time.

NSCalendarDate *date = [NSCalendarDate dateWithString:@"18:00" calendarFormat:@"%H:%M"];
      NSLog(@"date %@", date);

2003-07-03 21:17:17.340 FBTest[20695] date 0000-01-02 06:00:00 +0100

NSCalendarDate *date = [NSCalendarDate dateWithString:@"23:59" calendarFormat:@"%H:%M"];
      NSLog(@"date %@", date);

2003-07-03 21:21:19.064 FBTest[20772] date 0000-01-02 00:01:00 +0100


Is this correct behaviour? I don't think so. If it is please enlighten me. I am using a database adaptor that reads a time from the database and uses

NSCalendarDate *date = [[NSCalendarDate alloc] initWithYear:0 month:0 day:0 hour:18 minute:0 second:0 timeZone:nil];

to create an NSCalendarDate from just two integers. This works as expected on MacOSX. However, it produces

2003-07-03 20:44:40.516 FBTest[18838] File NSCalendarDate.m: 1239. In [NSCalendarDate -initWithYear:month:day:hour:minute:second:timeZone:] invalid month given - 0

on GNUstep. I think there is something wrong with the current behaviour.

Regards,

   Andreas









reply via email to

[Prev in Thread] Current Thread [Next in Thread]