tomaszkam / date

A date and time library based on the C++11/14/17 <chrono> header
Other
0 stars 0 forks source link

[LWG3218] Modifier for %d parse flag does not match POSIX and format spec. #3

Closed tomaszkam closed 5 years ago

tomaszkam commented 5 years ago

Original comment:

%d parse: change %Ed to %Od.

tomaszkam commented 5 years ago

Discussion: Currently, the '%d' parse flags accepts 'E' modifier to parse the locale's alternative representation, see "Table 88 — Meaning of parse flags": (http://eel.is/c++draft/time.parse#11.sentence-26):

The modified command %Ed interprets the locale's alternative representation of the day of the month.

This is inconsistent with the POSIX strftime specification (http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html) and the format functions, that uses 'O' to output alternate locale representation. Per "Table 87 — Meaning of format conversion specifiers (http://eel.is/c++draft/time.format#17.sentence-28).

The modified command %Od produces the locale's alternative representation.

Proposed wording: Change the %d entry in the "Table 88 — Meaning of parse flags" as follows: The day of the month as a decimal number. The modified command %Nd specifies the maximum number of characters to read. If N is not specified, the default is 2. Leading zeroes are permitted but not required. The modified command %EOd interprets the locale's alternative representation of the day of the month.

tomaszkam commented 5 years ago

The implementation already uses 'O' modifier, see: https://github.com/HowardHinnant/date/blob/master/include/date/date.h#L6702-L6713