Your task is to output a single number; the number of ISO weeks that a given date range intersects. To quote Wikipedia: An average year is exactly 52.1775 weeks long
, but this is not about the average.
Input consists of two space-separated ISO dates:
0047-12-24 2013-06-01
The end date is never before the start date. We'll use the extrapolated Gregorian calendar for simplicity.
Test cases:
Format: input -> output
2015-12-31 2016-01-01 -> 1 (both are within week 53 of 2015)
2016-01-03 2016-01-04 -> 2 (the 3rd is within week 53, and the 4th is in week 1)
2015-12-24 2015-12-24 -> 1 (this single day is of course within a single week)
Your solution should handle dates between 0001-01-01
and 9999-12-31
.
Weeks start with Monday.
\$\endgroup\$