Opened 9 years ago
Closed 5 years ago
#8528 closed Bugs (duplicate)
time_input_facet doesn't support %e
Reported by: | Owned by: | az_sw_dude | |
---|---|---|---|
Milestone: | To Be Determined | Component: | date_time |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | Cc: |
Description
time_input_facet doesn't support the %e substitution for days without leading zero.
This means that the following code for parsing RFC 2822 dates fails:
auto time_facet = new boost::posix_time::time_input_facet; time_facet->format("%a, %e %b %Y %H:%M:%S");
Test strings (note that time zone portion is not parsed):
Tue, 15 Jan 2013 06:50:21 -0700 Wed, 9 Jan 2013 12:33:57 -0700
Also note that the second date makes %a, %d %b %Y a non-starter.
The attached patch fixes the problem for me. The patch is against 1.51, but I check the 1.53 code and upon a brief code inspection it didn't appear to have changed significantly.
Note that I made no attempt to verify how it behaves on badly constructed input; I simply cloned the %d code and changed it to call parse_var_day_of_month() instead of parse_day_of_month().
Attachments (1)
Change History (3)
by , 9 years ago
Attachment: | time_facet_e.diff added |
---|
comment:1 by , 7 years ago
There are a few of us out there who would benefit greatly from being able to parse date, hour, etc as single digits without the leading zeros. Some customers just give us data in that format.
comment:2 by , 5 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #13194, for which a pull request was submitted. Closing as a duplicate.
patch adding support for %e to time_input_facet