Two digit year is considered as 19xx instead of 20xx in datepicker

RESOLVED FIXED

Status

Calendar
Sunbird Only
--
minor
RESOLVED FIXED
14 years ago
12 years ago

People

(Reporter: Mostafa Hosseini, Assigned: Mostafa Hosseini)

Tracking

Details

Attachments

(1 attachment)

(Assignee)

Description

14 years ago
As reported in :
http://forums.mozillazine.org/viewtopic.php?t=118981
if you enter 04 in the datepicker it is interpreted as 1904 instead 2004.
Would be good to have two year digits default to the current century.
Ccing gekacheka since he is familiar with the dateUtils.js code.

Comment 1

14 years ago
Created attachment 157161 [details] [diff] [review]
dateUtils.js patch: convert two digit years to four digits in any format, not just 2-digit format

Currently parseShortDate only converts two digit years to four digit years if
the O.S. date format uses a two digit year.

With this patch it converts two digit years to four digit years in any format.

(Note: this means that it can never parse years from year 0 C.E. to year 99
C.E.  I tried making it possible to specify those years if four digits were
specified, such as year 0099, but it turns out at least on Windows O.S.
dateService.formatDate also converts two digit years to 1900+year so those
years are not presented correctly even if they were parsed correctly.  Since
Calendar currently uses the JavaScript Date object which implements a Gregorian
calendar, and the Gregorian calendar wasn't in use during those years, it is
probably not useful to represent those years anyway.)
(Assignee)

Comment 2

14 years ago
Checked in.
Thanks
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
Windows (perhaps other OSes) has a system setting to determine how two-digit
years are interpreted. Respecting such a setting where it exists would be optimal.

Of course, the current implementation is wholly satisfactory for now. (But in 90
years' time...)

Comment 4

14 years ago
*** Bug 258563 has been marked as a duplicate of this bug. ***
The bugspam monkeys have been set free and are feeding on Calendar :: Sunbird Only. Be afraid for your sanity!
QA Contact: gurganbl → sunbird
You need to log in before you can comment on or make changes to this bug.