Hi,

the attached patch updates "FIXMEs" in NSCalendar.h now that we know when the new features were really introduced.

It also adds -[NSDateComponents date]. While this method isn't documented very well, this code should match the behavior of Apple's Foundation.

Regards,
--
Luboš Doležel
--- gnustep-base-1.24.3/Headers/Foundation/NSCalendar.h.orig	2013-03-19 13:58:09.155292011 +0100
+++ gnustep-base-1.24.3/Headers/Foundation/NSCalendar.h	2013-03-19 13:59:53.390661803 +0100
@@ -85,9 +85,7 @@
   NSInteger _weekday;
   NSInteger _weekdayOrdinal;
   NSInteger _quarter;
-// FIXME: In reality these are only available on iOS > 4.  Will probably show
-// up in OS X 10.7.
-#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
+#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
   NSCalendar *_cal;
   NSTimeZone *_tz;
 #endif
@@ -120,12 +118,12 @@
 - (void) setQuarter: (NSInteger) v;
 #endif
 
-// FIXME: In reality these are only available on iOS > 4.
-#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
+#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
 - (NSCalendar *) calendar;
 - (NSTimeZone *) timeZone;
 - (void) setCalendar: (NSCalendar *) cal;
 - (void) setTimeZone: (NSTimeZone *) tz;
+- (NSDate *) date;
 #endif
 @end
 
--- gnustep-base-1.24.3/Source/NSCalendar.m.orig	2013-01-24 10:15:53.000000000 +0100
+++ gnustep-base-1.24.3/Source/NSCalendar.m	2013-03-19 14:03:25.692268767 +0100
@@ -741,6 +741,16 @@
   return _tz;
 }
 
+- (NSDate *) date
+{
+  NSCalendar* cal = [self calendar];
+  NSTimeZone* zone = [self timeZone];
+
+  if (zone != NULL)
+    [cal setTimeZone: zone];
+
+  return [cal dateFromComponents: self];
+}
 
 
 - (void) setDay: (NSInteger) v
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to