Skip to content

Commit

Permalink
fix broken runnableExamples for getWeeksInIsoYear (nim-lang#20193)
Browse files Browse the repository at this point in the history
Based on what I understand from [Wikipedia](https://en.wikipedia.org/wiki/ISO_week_date#Weeks_per_year), 2001 does not have 53 weeks, but 2004, 2009, 2015, 2020 do. The years 2000 and 2001 seem to be copy pasted from the `getDaysInYear` example above. The result of `getWeeksInIsoYear` also seem to match up with Wikipedia.

That means these runnableExamples were never tested. Why is this the case? I only discovered this in nim-lang#20091.
  • Loading branch information
metagn committed Aug 12, 2022
1 parent 2883262 commit 7d1a17f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pure/times.nim
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ proc getWeeksInIsoYear*(y: IsoYear): IsoWeekRange {.since: (1, 5).} =
## Returns the number of weeks in the specified ISO 8601 week-based year, which can be
## either 53 or 52.
runnableExamples:
assert getWeeksInIsoYear(IsoYear(2000)) == 52
assert getWeeksInIsoYear(IsoYear(2001)) == 53
assert getWeeksInIsoYear(IsoYear(2019)) == 52
assert getWeeksInIsoYear(IsoYear(2020)) == 53

var y = int(y)

Expand Down

0 comments on commit 7d1a17f

Please sign in to comment.