Optional leading zero for the 'day of month' format specifier
- Dominant language
- C++
- Stars
- 70
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
The [documentation](https://www.boost.org/doc/libs/1_70_0/doc/html/date_time/date_time_io.html#date_time.format_flags) for the format flags of date/time input facets state
"%d - Day of the month as decimal 01 to 31. When used to parse input, **the leading zero is optional**".
Does this also apply to the time input facet? The time input face code does something else:
https://github.com/boostorg/date_time/blob/b0437e2999a65668dc4178dbb817a89a382ece94/include/boost/date_time/time_facet.hpp#L1096
Hence, it fails to parse a date/time string of format "%m-%d-%Y %H:%M:%S", e.g. "6-5-2019 21:06:15".
Minimal example code:
wstring s = L"6-5-2019 21:06:15";
wistringstream in{ s };
in.imbue({ locale::classic(), new wtime_input_facet{L"%m-%d-%Y %H:%M:%S"} });
ptime pt;
in >> pt;
assert(!pt.is_not_a_date_time());
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.