Monotone-Parent: 24cd0f4a54d77d53f8c9e4dc117f32e9a5c42d72
Monotone-Revision: 3330b71df0d8c44d51c1026cc042cc4c911cff1a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-07T16:20:01 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
36a5c192f0
commit
f58ab98f0d
|
@ -1,5 +1,9 @@
|
|||
2007-06-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* NSString+NGCards.m ([NSString -isAllDayDate]): new method that
|
||||
determines whether the date represented in "self" is an all day
|
||||
date (date only) or not (date + time).
|
||||
|
||||
* CardElement.h: moved IS_EQUAL macro from removed module
|
||||
"common.h".
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
- (NSTimeInterval) durationAsTimeInterval;
|
||||
- (NSCalendarDate *) asCalendarDate;
|
||||
- (BOOL) isAllDayDate;
|
||||
|
||||
- (NSArray *) commaSeparatedValues;
|
||||
|
||||
|
|
|
@ -214,9 +214,11 @@ static NSString *commaSeparator = nil;
|
|||
NSRange cursor;
|
||||
NSCalendarDate *date;
|
||||
NSTimeZone *utc;
|
||||
unsigned int length;
|
||||
int year, month, day, hour, minute, second;
|
||||
|
||||
if ([self length] > 14)
|
||||
length = [self length];
|
||||
if (length > 7)
|
||||
{
|
||||
cursor = NSMakeRange(0, 4);
|
||||
year = [[self substringWithRange: cursor] intValue];
|
||||
|
@ -226,12 +228,21 @@ static NSString *commaSeparator = nil;
|
|||
cursor.location += cursor.length;
|
||||
day = [[self substringWithRange: cursor] intValue];
|
||||
|
||||
cursor.location += cursor.length + 1;
|
||||
hour = [[self substringWithRange: cursor] intValue];
|
||||
cursor.location += cursor.length;
|
||||
minute = [[self substringWithRange: cursor] intValue];
|
||||
cursor.location += cursor.length;
|
||||
second = [[self substringWithRange: cursor] intValue];
|
||||
if (length > 14)
|
||||
{
|
||||
cursor.location += cursor.length + 1;
|
||||
hour = [[self substringWithRange: cursor] intValue];
|
||||
cursor.location += cursor.length;
|
||||
minute = [[self substringWithRange: cursor] intValue];
|
||||
cursor.location += cursor.length;
|
||||
second = [[self substringWithRange: cursor] intValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
hour = 0;
|
||||
minute = 0;
|
||||
second = 0;
|
||||
}
|
||||
|
||||
utc = [NSTimeZone timeZoneWithAbbreviation: @"GMT"];
|
||||
date = [NSCalendarDate dateWithYear: year month: month
|
||||
|
@ -245,6 +256,19 @@ static NSString *commaSeparator = nil;
|
|||
return date;
|
||||
}
|
||||
|
||||
- (BOOL) isAllDayDate
|
||||
{
|
||||
unsigned int length;
|
||||
unichar lastZ;
|
||||
|
||||
length = [self length];
|
||||
lastZ = [self characterAtIndex: length - 1];
|
||||
|
||||
return (length == 8
|
||||
|| (length == 9
|
||||
&& (lastZ == 'Z' || lastZ == 'z')));
|
||||
}
|
||||
|
||||
- (NSArray *) commaSeparatedValues
|
||||
{
|
||||
NSEnumerator *rawValues;
|
||||
|
|
Loading…
Reference in New Issue