Date.st
branchjv
changeset 17732 a1892eeca6c0
parent 17728 bbc5fa73dfab
child 17734 406b1590afe8
--- a/Date.st	Fri Aug 28 12:38:51 2009 +0100
+++ b/Date.st	Sat Oct 24 16:48:19 2009 +0100
@@ -157,7 +157,7 @@
     DefaultFormats at:#'en' put:(enDefaultFormat := '%d-%m-%y').
     ShortFormats at:#'en' put:(enShortFormat := '%d-%m-%y').
     LongFormats at:#'en' put:(enLongFormat := '%(dayName), %d-%m-%y').
-
+    "/ take the "master" language here, for the caching
     EnvironmentChange := (Smalltalk language asSymbol ~~ #'en').
 
     "
@@ -357,7 +357,7 @@
      is different from the format expected by readFrom:.
      BUG:
        This method handles american format (i.e. month/day/year),
-       common  format with letter month in the middle (10 December 2007)
+       common format with letter month in the middle (10 December 2007)
        and ISO format (yyyy-mm-dd) - as long as yyyy is > 12.
 
        It does not handle the german/french and other dd-mm-yyyy.
@@ -444,6 +444,11 @@
      Date readFrom:'5:12:1999' printFormat:#( 2 1 3 )  
      Date readFrom:'may-12-1999' printFormat:#( 2 1 3 )  
      Date readFrom:'1999 may 12' printFormat:#( 3 2 1 )  
+
+     Date readFrom:'31/12/01' printFormat:'%d %m %y' onError:'fail'       
+     Date readFrom:'12/01' printFormat:'%m %y' onError:'fail'       
+     Date readFrom:'01' printFormat:'%y' onError:'fail'        
+     Date readFrom:'30.01' printFormat:'%d %m' onError:'fail'       
     "
 
     "Created: 16.11.1995 / 22:50:17 / cg"
@@ -751,7 +756,6 @@
     "
 ! !
 
-
 !Date class methodsFor:'change & update'!
 
 update:something with:aParameter from:changedObject
@@ -1623,13 +1627,26 @@
 
     "
      Date today               
-     Date today firstDayInMonth   
+     Date today firstDayInMonth    
+     Date today firstDayInMonth subtractDays:1   
      (Date today subtractDays:30) firstDayInMonth   
      (Date today subtractDays:122) firstDayInMonth   
      (Date today subtractDays:154) firstDayInMonth
     "
 !
 
+lastDayInMonth 
+    "Return the last day in the month in which the receiver is."
+
+    ^ self addDays:(self daysInMonth - self day).
+
+    "
+     Date today       
+     Date today lastDayInMonth        
+     Date today lastDayInMonth addDays:1  
+    "
+!
+
 next:dayName 
     "Return the next date whose weekday name is dayName.
      Caveat; dayName is expected to be in the current language"
@@ -2542,6 +2559,7 @@
     "deprecated, use #asTimestamp"
     <resource:#obsolete>
 
+    self obsoleteMethodWarning:'use #asTimestamp'.
     ^ self asTimestamp
 !
 
@@ -2935,7 +2953,12 @@
 !Date class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Date.st 10467 2009-08-19 16:14:36Z vranyj1 $'
+    ^ '$Id: Date.st 10473 2009-10-24 15:48:19Z vranyj1 $'
+!
+
+version_CVS
+    ^ '§Header: /cvs/stx/stx/libbasic/Date.st,v 1.129 2009/10/07 15:33:07 cg Exp §'
 ! !
 
 Date initialize!
+