Opened 15 years ago
Closed 11 years ago
#1674 closed Bugs (fixed)
date_time::date_formatting.hpp: incorrectly formats year using global locale
Reported by: | Owned by: | az_sw_dude | |
---|---|---|---|
Milestone: | Boost 1.36.0 | Component: | date_time |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | locale formatting | Cc: |
Description
The function boost::date_time::ymd_formatter::ymd_to_string() uses the ostream<<() function to write the date. This later function will use the current global locale to format each of the elements of the date. In particular, when the global locale is set to en_US, the year will be formatted to be 2,008 which is incorrect.
The proposed solution is to temporarily imbue the ostream with the classic locale to disable formatting. The attached patch only applies this to the year but it would be more robust to apply to the day and month components as well.
This type of error probably exists in other functions.
Attachments (2)
Change History (6)
by , 15 years ago
Attachment: | boost_date_time_date_formatting_hpp.patch added |
---|
comment:1 by , 12 years ago
by , 12 years ago
Attachment: | boost-date_time-1674.patch added |
---|
Updated patch to apply cleanly to r68583 on trunk.
comment:2 by , 11 years ago
Hi,
Any chances to have this bug fixed? I am using 1.46.1 and still see this issue. This is very unexpected and undocumented behaviour to get year with comma inside if locale is set to en_US.
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Is there a chance we can get this tested as well? Would you care to provide a minimal test case?