<chrono> formatting: extend %r, add %g %G %U %V %W
#1869
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
elsewithif constexprto avoid dead code._Check_modifier,_Is_valid_type, and_Fmt_stringcan bestatic.ifstatements.%rreplacement logic to all types (local_time_format()andzoned_time).hh_mm_ssand updating the tests accordingly.%rnow prints a space, I'm adding commas.%g %G(ISO week-based year) and%U %V %W(various flavors of week number).time_point(which also powerslocal_time_format()andzoned_time) and theyear_month_dayfamily.year_monthcan print the ISO week-based year as long as we're not in January or December (when ISO and Gregorian have differences)._Is_valid_type, we list%g %Gas being valid foryear_month, and%g %G %U %V %W(in table-sorted order) as being valid for theyear_month_dayfamily. This cascades totime_point,local_time_format(), andzoned_time._Custom_write, we need to detectyear_monthand reject Jan/Dec. Otherwise, we manually print the year by mapping the ISO types to Gregorian types (this grants us the correct padding and number of digits).put_timehandles everything else. 😸sys_daysobserving various transition points.year_monthtests the rejected and accepted cases.year_month_day(since this one is "fundamental").