lib/cocoa/sugarcube-nsdate/nsdate.rb in sugarcube-3.0.5 vs lib/cocoa/sugarcube-nsdate/nsdate.rb in sugarcube-3.0.6
- old
+ new
@@ -52,11 +52,11 @@
# <http://www.unicode.org/reports/tr35/tr35-19.html#Date_Field_Symbol_Table>
# for more information about date format strings.
def string_with_format(format, options={})
locale = options[:locale] || NSLocale.currentLocale
timezone = options[:timezone] || NSTimeZone.defaultTimeZone
-
+
if format.is_a?(Symbol)
formatters = SugarCubeFormats[format]
raise "No format found for #{format.inspect}" unless formatters
locale = NSLocale.localeWithLocaleIdentifier "en_US"
retval = ''
@@ -121,9 +121,19 @@
end
def today?
today = self.class.new
return same_day?(today)
+ end
+
+ def tomorrow?
+ tomorrow = self.class.tomorrow
+ return same_day?(tomorrow)
+ end
+
+ def yesterday?
+ yesterday = self.class.yesterday
+ return same_day?(yesterday)
end
def same_day?(other)
return other.day == self.day &&
other.month == self.month &&