Permalink
Browse files

Fixing date formatting libraries.

  • Loading branch information...
1 parent bed3fd6 commit 721fff79ab982e78a1c7d3bff513033dfbed9bab @pk committed Feb 17, 2012
@@ -61,7 +61,7 @@
E9520D701459ADFE00BFA0F7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9470FE01459994500E02867 /* UIKit.framework */; };
E9520D721459AE7C00BFA0F7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E9520D711459AE7C00BFA0F7 /* libz.dylib */; };
E9520D731459AE9500BFA0F7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E9520D711459AE7C00BFA0F7 /* libz.dylib */; };
- E96B5154149B8F6A003D0AEA /* NSDate+PKStandardFormats.h in Headers */ = {isa = PBXBuildFile; fileRef = E96B5150149B8F6A003D0AEA /* NSDate+PKStandardFormats.h */; };
+ E96B5154149B8F6A003D0AEA /* NSDate+PKStandardFormats.h in Headers */ = {isa = PBXBuildFile; fileRef = E96B5150149B8F6A003D0AEA /* NSDate+PKStandardFormats.h */; settings = {ATTRIBUTES = (Public, ); }; };
E96B5155149B8F6A003D0AEA /* NSDate+PKStandardFormats.m in Sources */ = {isa = PBXBuildFile; fileRef = E96B5151149B8F6A003D0AEA /* NSDate+PKStandardFormats.m */; };
E96B5156149B8F6A003D0AEA /* NSDate+PKStandardFormats.m in Sources */ = {isa = PBXBuildFile; fileRef = E96B5151149B8F6A003D0AEA /* NSDate+PKStandardFormats.m */; };
E96B5157149B8F6A003D0AEA /* NSDateFormatter+PKStandardFormats.h in Headers */ = {isa = PBXBuildFile; fileRef = E96B5152149B8F6A003D0AEA /* NSDateFormatter+PKStandardFormats.h */; };
@@ -597,8 +597,10 @@
DSTROOT = /tmp/PKToolbox.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PKToolbox/PKToolbox-Prefix.pch";
+ INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
+ PUBLIC_HEADERS_FOLDER_PATH = PKToolbox;
SKIP_INSTALL = YES;
};
name = Debug;
@@ -609,8 +611,10 @@
DSTROOT = /tmp/PKToolbox.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PKToolbox/PKToolbox-Prefix.pch";
+ INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
+ PUBLIC_HEADERS_FOLDER_PATH = PKToolbox;
SKIP_INSTALL = YES;
};
name = Release;
@@ -15,6 +15,8 @@
- (NSString *)iso8601String;
++ (NSDate *)dateFromISO8601:(NSString *)aDate;
+
/**
* Convert a 'Full-Date' string
* (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
@@ -25,7 +25,7 @@ - (NSString *)iso8601String {
- (NSString *)rfc2616String {
static NSDateFormatter *df = nil;
if(df == nil) {
- df = [NSDateFormatter rfc2616DateFormatterWithFormat:rfc1123Format];
+ df = [NSDateFormatter rfc2616DateFormatterWithFormat:(NSString *)rfc1123Format];
}
return [df stringFromDate:self];
}
@@ -54,7 +54,7 @@ + (NSDate *)dateFromRFC1123:(NSString *)aDate {
if(aDate == nil) return nil;
static NSDateFormatter *df = nil;
if(df == nil) {
- df = [NSDateFormatter rfc2616DateFormatterWithFormat:rfc1123Format];
+ df = [NSDateFormatter rfc2616DateFormatterWithFormat:(NSString *)rfc1123Format];
}
return [df dateFromString:aDate];
}
@@ -63,7 +63,7 @@ + (NSDate *)dateFromRFC850:(NSString *)aDate {
if(aDate == nil) return nil;
static NSDateFormatter *df = nil;
if(df == nil) {
- df = [NSDateFormatter rfc2616DateFormatterWithFormat:rfc850Format];
+ df = [NSDateFormatter rfc2616DateFormatterWithFormat:(NSString *)rfc850Format];
}
return [df dateFromString:aDate];
}
@@ -72,7 +72,7 @@ + (NSDate *)dateFromANSIC:(NSString *)aDate {
if(aDate == nil) return nil;
static NSDateFormatter *df = nil;
if(df == nil) {
- df = [NSDateFormatter rfc2616DateFormatterWithFormat:ansicFormat];
+ df = [NSDateFormatter rfc2616DateFormatterWithFormat:(NSString *)ansicFormat];
}
return [df dateFromString:aDate];
}
@@ -5,28 +5,16 @@
// Created by Pavel Kunc on 16/12/2011.
// Copyright (C) 2011 by Pavel Kunc, http://pavelkunc.cz
-extern static NSString const *rfc1123Format;
-extern static NSString const *rfc850Format;
-extern static NSString const *ansicFormat;
-extern static NSString const *iso8601Format;
+extern NSString const *rfc1123Format;
+extern NSString const *rfc850Format;
+extern NSString const *ansicFormat;
+extern NSString const *iso8601Format;
@interface NSDateFormatter (PKStandardFormats)
-+ (NSDateFormatter *)iso8601DateFormatter {
- NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease];
- df.timeStyle = NSDateFormatterFullStyle;
- df.dateFormat = iso8601Format;
- return df;
-}
-
-+ (NSDateFormatter *)rfc2616DateFormatterWithFormat:(NSString *)aFormat {
- NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease];
- df.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
- df.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
- df.dateFormat = aFormat;
- return df;
-}
++ (NSDateFormatter *)iso8601DateFormatter;
++ (NSDateFormatter *)rfc2616DateFormatterWithFormat:(NSString *)aFormat;
@end
@@ -7,18 +7,18 @@
#import "NSDateFormatter+PKStandardFormats.h"
-static NSString const *rfc1123Format = @"EEE',' dd MMM yyyy HH':'mm':'ss z";
-static NSString const *rfc850Format = @"EEEE',' dd'-'MMM'-'yy HH':'mm':'ss z";
-static NSString const *ansicFormat = @"EEE MMM d HH':'mm':'ss yyyy";
-static NSString const *iso8601Format = @"yyyy-MM-dd'T'hh:mm:ss'Z'";
+NSString const *rfc1123Format = @"EEE',' dd MMM yyyy HH':'mm':'ss z";
+NSString const *rfc850Format = @"EEEE',' dd'-'MMM'-'yy HH':'mm':'ss z";
+NSString const *ansicFormat = @"EEE MMM d HH':'mm':'ss yyyy";
+NSString const *iso8601Format = @"yyyy-MM-dd'T'HH:mm:ss'Z'";
@implementation NSDateFormatter (PKStandardFormats)
+ (NSDateFormatter *)iso8601DateFormatter {
NSDateFormatter *df = [[[NSDateFormatter alloc] init] autorelease];
df.timeStyle = NSDateFormatterFullStyle;
- df.dateFormat = @"yyyy-MM-dd'T'hh:mm:ss'Z'";
+ df.dateFormat = iso8601Format;
return df;
}

0 comments on commit 721fff7

Please sign in to comment.