Closed Bug 522642 Opened 10 years ago Closed 10 years ago

birthday field: improve handling of BirthYear for pre-1900 dates


(MailNews Core :: Address Book, defect)

Not set


(thunderbird3.1 beta1-fixed)

Thunderbird 3.1b1
Tracking Status
thunderbird3.1 --- beta1-fixed


(Reporter:, Assigned: pi)



(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090824 Firefox/3.5.3
Build Identifier: 3.0pre

The current UI allows users to enter two-digit years, eg '44' (meaning "44 AD") and the BirthYear field in the contact contains '44'.

However the UI, shows '1944'.

There's two problems with this:
1. there's no way of expressing pre-1900 dates in the Thunderbird UI.
   Not a big deal, but:
   a) this limitation is unnecessary and
   b)  if deemed desirable it should be enforced up-front in the UI at the time
   of data entry, not by applying heuristics on the underlying data.
2. what is stored is a variance with what is displayed.
   This means that if/when the contact is synced, the foreign client
   shows the year as '44', while Thunderbird shows it as '1944'.

Reproducible: Always

Steps to Reproduce:
1. create a contact born in the year 44.

Actual Results:  
UI shows year as 1944

Expected Results:  
UI should show year as 44.
Summary: improve handling of BirthYear for pre-1900 dates → birthday field: improve handling of BirthYear for pre-1900 dates
Confirmed.  The year stored in the contact is 44 AD and appears that way in new/edit contact dialog.  However, the contact view pane/summary shows a year of 1944.

That happened because the view pane used the Date constructor which treats a 2-digit year as if it were in the 1900s.

alert(new Date(44, 0, 1));
This will show a date of Jan 1, 1944.

Using dt.setFullYear(year); in abCardViewOverlay.js after calling the Date constructor appears to work.  I'll test it more after class and attach a patch.

The patch for Bug 456024 seems to work since it already uses setFullYear.
Ever confirmed: true
This patch adds date.setFullYear to abCardViewOverlay.js to avoid inaccurate results when displaying 2 or 3-digit years in the contact view/summary pane.

Thanks for reporting this (and CC'ing me)
Assignee: nobody → joshgeenen+bugzilla
Comment on attachment 406682 [details] [diff] [review]
abCardViewOverlay.js fix

Josh, you should ask for review for your patch.
Comment on attachment 406682 [details] [diff] [review]
abCardViewOverlay.js fix

I forgot to request review on this one.

All this patch does is use setFullYear to make sure the year is interpreted as a 4-digit number.
Attachment #406682 - Flags: review?(bugzilla)
Comment on attachment 406682 [details] [diff] [review]
abCardViewOverlay.js fix

Sorry for the delay in reviewing this, r=Standard8.
Attachment #406682 - Flags: superreview?(neil)
Attachment #406682 - Flags: review?(bugzilla)
Attachment #406682 - Flags: review+
Attachment #406682 - Flags: superreview?(neil) → superreview+
Checked in:
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.1b1
You need to log in before you can comment on or make changes to this bug.