Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Kernel-Chronology-Extras/Year.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ Year >> daysInYear [

{ #category : #accessing }
Year >> firstThursday [
"Return the years first Thursday.
According to the ISO 8601 definition, the first week starts with the years first Thursday (week day number 5)"
^ self start + (5 - self start dayOfWeek) days
"Return the year's first Thursday.
According to the ISO 8601 definition, the first week starts with the year's first Thursday (week day number 5)"
^ self start + ((5 - self start dayOfWeek + 7) rem: 7) days
]

{ #category : #changes }
Expand Down
13 changes: 13 additions & 0 deletions src/Kernel-Tests-Extended/YearTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ YearTest >> classToBeTested [
^ Year
]

{ #category : #tests }
YearTest >> testFirstThursday [

1800 to: 2000 do:
[ :y |
| firstThursday |
firstThursday := (Year year: y) firstThursday.
self assert: firstThursday dayOfWeek equals: 5.
self assert: firstThursday year equals: y.
self assert: (firstThursday - 1 week) year equals: y - 1 ]

]

{ #category : #tests }
YearTest >> testOffset [
"Check that the offset is maintained when creating a new instance of Month from a DateAndTime"
Expand Down