Function steadyIsoWeek

modifyed steady isoWeek (ranging from 0 to 53 weeks)

auto steadyIsoWeek(T) (
  T data
) pure nothrow @property @safe;

Return a modified isoWeek value, which is monotonically increasing with the supplied date. The built-in isoWeek based on ISO8601 sometimes already uses the number 1 for the last days of the last week in the following cases, e.g.:

Example 1 : 2019-Dec-30 : Result of isoWeek 01 differs from steadyIsoWeek 53 -> 0.19.53.0 2019-Dec-31 : Result of isoWeek 01 differs from steadyIsoWeek 53 -> 0.19.53.14

Example 2:

2021-Jan-01 : Result of isoWeek 53 differs from steadyIsoWeek 00 -> 0.21.0.57 2021-Jan-02 : Result of isoWeek 53 differs from steadyIsoWeek 00 -> 0.21.0.71 2021-Jan-03 : Result of isoWeek 53 differs from steadyIsoWeek 00 -> 0.21.0.85

So the isoWeek number 1 is returned twice: On time at the bin o the year, and a second time at the end of the year.

This would break comparisions of time-tag version tags. So these cases are fixed up to return week 53 for these remaining days at the end of a year.

So Date(2018-Dec-31) doesn't return the same value as Date(2018-Jan-01)- Date(2018-Jan-07), but 53 instead. So ordered compares will evaluate into the correct result.

Same logic applies for an isoWeek number of 53 at the beginning of a year. In this cases the value is set to 0. So again values can be compared and result in senseful results.

Param

data - either a Date, DateTime or any other type providing a 'isoWeek' property.

Returns

The isoWeek starting from 0 to 53