mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-05 21:54:27 +02:00
Updated Examples and Recipes (markdown)
@@ -737,7 +737,7 @@ normalize(date::year_month_day ymd)
|
|||||||
|
|
||||||
The first line simply adds 0 months to the `ymd`. If `ymd.month()` is 0, this will subtract one from the `year` and set the month to `Dec`. If `ymd.month()` is greater than 12, the year will be incremented as many times as appropriate, and the month will be brought within the proper range. This operation will do nothing if `ymd.month().ok()` is already true.
|
The first line simply adds 0 months to the `ymd`. If `ymd.month()` is 0, this will subtract one from the `year` and set the month to `Dec`. If `ymd.month()` is greater than 12, the year will be incremented as many times as appropriate, and the month will be brought within the proper range. This operation will do nothing if `ymd.month().ok()` is already true.
|
||||||
|
|
||||||
The second line will "normalize" the day field. The second line requires that the month field is already normalized. For example `2015_y/dec/32` will become `2016_y/jan/1`. If the day field is already in range, there will be no change.
|
The second line will "normalize" the day field. The second line requires that the month field is already normalized. For example `2015_y/December/32` will become `2016_y/January/1`. If the day field is already in range, there will be no change.
|
||||||
|
|
||||||
The conversion from `year_month_day` to `sys_days` calls this algorithm:
|
The conversion from `year_month_day` to `sys_days` calls this algorithm:
|
||||||
|
|
||||||
@@ -795,7 +795,7 @@ fifth_friday(date::year y)
|
|||||||
dates[n] = year_month_day{d};
|
dates[n] = year_month_day{d};
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
if (m == dec)
|
if (m == December)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return {dates, n};
|
return {dates, n};
|
||||||
|
Reference in New Issue
Block a user