ocaml-community / calendar

OCaml library for handling dates and times.
Other
42 stars 9 forks source link

Calendar: off by one in week-of-year ( week_first_last ) ( calendar 2.04 ) #14

Closed loxs closed 6 years ago

loxs commented 6 years ago

Originally reported here by Oliver Bandel

Week one in 2017 starts at 2017-01-02 and ends at 2017-01-08.

But week_first_last 1 2017 gives 2016-12-26 ... 2017-01-01

So the result is off by one.

This is affected by this commit

loxs commented 6 years ago

Here ISO 8601 deviates from the Gregorian calendar: https://en.wikipedia.org/wiki/ISO_week_date#Relation_with_the_Gregorian_calendar

If it was solely upon me, I would follow ISO (keep the changes in the above commit).

Can someone think of a reason not to?