After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 334648 - Date sometimes wrongly parsed in British locale.
Date sometimes wrongly parsed in British locale.
Status: RESOLVED FIXED
Product: glom
Classification: Other
Component: data mode
git master
Other Linux
: Normal normal
: ---
Assigned To: Murray Cumming
Murray Cumming
Depends on:
Blocks:
 
 
Reported: 2006-03-15 13:08 UTC by Murray Cumming
Modified: 2008-11-20 18:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testdateput_allformats.cc (2.00 KB, text/plain)
2006-03-15 13:33 UTC, Murray Cumming
Details
time_put_all_formats.txt (1021 bytes, text/plain)
2006-03-15 13:34 UTC, Murray Cumming
Details
testdateput_allformats.cc (2.46 KB, text/plain)
2006-03-15 14:35 UTC, Murray Cumming
Details
time_put_all_formats_en_GB.txt (1018 bytes, text/plain)
2006-03-15 14:36 UTC, Murray Cumming
Details
time_put_all_formats_en_US.txt (1.01 KB, text/plain)
2006-03-15 14:37 UTC, Murray Cumming
Details
time_put_all_formats_de.txt (1017 bytes, text/plain)
2006-03-15 14:38 UTC, Murray Cumming
Details

Description Murray Cumming 2006-03-15 13:08:46 UTC
Case 1:

In a en_GB locale, entering "01/02/1973" results in "01/02/19".

This seems to be a problem with std::time_get<>::get_date(), which we try first. 

Strangely, it succeeds (also using std::time_get<>::get_date()) when entering "01.02.1973". or "01-02-1973", though the "correct" separator seems to be "/". Well, that's what's used for display when we get a text representation using std::time_put<>::put().

Case 2:

In a en_GB locale, entering "01/02/04" results in "01/02/04", but that 04 has actually been stored internally as 1904. There's a reasonable expectation that it would be 2004. If we can fix the display to always use 4 digits, even in a british locale, then the user would see, and could specify exactly what they want.

(In an en_US locale, it displays and parses 4-digit years. I'd prefer to never show 2 digit years, in any locale, to avoid confusion.)
Comment 1 Murray Cumming 2006-03-15 13:33:01 UTC
Created attachment 61295 [details]
testdateput_allformats.cc

Example code from roguewave's std::time_put documentation, listing result of all formats in the current locale.
Comment 2 Murray Cumming 2006-03-15 13:34:48 UTC
Created attachment 61296 [details]
time_put_all_formats.txt

Output from the roguewave examples (logged into a british locale - $LANG=en_GB.UTF-8), showing that none of the formats shows 4 digits for the year.
Comment 3 Murray Cumming 2006-03-15 14:35:21 UTC
Created attachment 61299 [details]
testdateput_allformats.cc

Corrected, to actually use the current locale. Roguewave's example was not that great, though at least they have an example.
Comment 4 Murray Cumming 2006-03-15 14:36:47 UTC
Created attachment 61300 [details]
time_put_all_formats_en_GB.txt
Comment 5 Murray Cumming 2006-03-15 14:37:36 UTC
Created attachment 61301 [details]
time_put_all_formats_en_US.txt

USA (uses 4 digits)
Comment 6 Murray Cumming 2006-03-15 14:38:08 UTC
Created attachment 61302 [details]
time_put_all_formats_de.txt

Germany (Uses 4 digits)
Comment 7 Murray Cumming 2006-03-15 14:45:37 UTC
I have reported the time_put problem in the g++ bug database:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26697
Comment 8 Murray Cumming 2006-03-15 18:08:13 UTC
And here is the g++ bug for time_get():
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26701

I will have to work around this lack in the C++ standard, in some locales. I have an idea how to do that.
Comment 9 Murray Cumming 2006-03-15 22:01:45 UTC
Fixed, by making the "%x" format translatable, so that translators can choose, for instance, %d/%m/%Y instead, if their locale is "broken".
Comment 10 Murray Cumming 2008-11-20 18:56:10 UTC
(In reply to comment #3)
> Created an attachment (id=61299) [edit]
> testdateput_allformats.cc
> 
> Corrected, to actually use the current locale. Roguewave's example was not that
> great, though at least they have an example.

That crashes for me on Ubuntu Intrepid, though I can't figure out why.