File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -82,8 +82,11 @@ DateTest >> testAddDays [
82
82
{ #category : 'tests' }
83
83
DateTest >> testAddMonths [
84
84
85
+ | dateOutOfTimeZone |
85
86
self assert: (january23rd2004 addMonths: 0) equals: (Date readFrom: '23-1-2004' pattern: 'd-m-y').
86
87
self assert: (january23rd2004 addMonths: 1) equals: (Date readFrom: '23-2-2004' pattern: 'd-m-y').
88
+ dateOutOfTimeZone := january23rd2004 offset: (january23rd2004 offset + 1 hour).
89
+ self assert: (dateOutOfTimeZone addMonths: 1) offset equals: dateOutOfTimeZone offset.
87
90
self assert: (january23rd2004 addMonths: 12) equals: (Date readFrom: '23-1-2005' pattern: 'd-m-y')
88
91
]
89
92
Original file line number Diff line number Diff line change 7
7
#classVars : [
8
8
' DayNames' ,
9
9
' DaysInMonth' ,
10
+ ' Epoch' ,
10
11
' HoursInDay' ,
11
12
' MicrosecondsInDay' ,
12
13
' MinutesInHour' ,
@@ -16,8 +17,7 @@ Class {
16
17
' NanosInSecond' ,
17
18
' SecondsInDay' ,
18
19
' SecondsInHour' ,
19
- ' SecondsInMinute' ,
20
- ' Epoch'
20
+ ' SecondsInMinute'
21
21
],
22
22
#category : ' System-Time' ,
23
23
#package : ' System-Time'
Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ Date >> addMonths: monthCount [
303
303
month := self monthIndex + monthCount - 1 \\ 12 + 1 .
304
304
maxDaysInMonth := Month daysInMonth: month forYear: year.
305
305
day := self dayOfMonth min: maxDaysInMonth.
306
- ^ Date year: year month: month day: day
306
+ ^ ( Date year: year month: month day: day) translateTo: self offset
307
307
]
308
308
309
309
{ #category : ' accessing' }
You can’t perform that action at this time.
0 commit comments