Closed Bug 1592536 Opened 5 years ago Closed 5 years ago

age in address book wrong calculated (month calculation off by one)

Categories

(Thunderbird :: Address Book, defect)

defect
Not set
normal

Tracking

(thunderbird_esr6870+ fixed, thunderbird71 fixed, thunderbird72 fixed)

RESOLVED FIXED
Thunderbird 72.0
Tracking Status
thunderbird_esr68 70+ fixed
thunderbird71 --- fixed
thunderbird72 --- fixed

People

(Reporter: unimportant.stuff, Assigned: darktrojan)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

Thunderbird 68.2.0 (32-Bit) german.
Open Addressbuch. Search contact. Open contact with double-click. Klick Privat in order to enter the birthday.
Entered birthday Oktober 28 1969.

Actual results:

The age (Alter) is shown 49 instead of 50.
Same issue happens e.g. for Oktober 1.

Expected results:

Today is October 30 2019. So it should be 50 years since two days.

Summary: age wrong → age in address book wrong calculated

Confirmed. If you add the current date, you get age -1, that's not pretty either.

Geoff, you changed that code recently.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(geoff)

Failed to take into account that in javascript the months are numbered 0-11. :-/

Flags: needinfo?(geoff)
Attached patch 1592536-age-calculation-1.diff (obsolete) — Splinter Review
Assignee: nobody → geoff
Status: NEW → ASSIGNED
Attachment #9106116 - Flags: review?(mkmelin+mozilla)
Attachment #9106116 - Flags: approval-comm-esr68?
Attachment #9106116 - Flags: approval-comm-beta?
Attachment #9106116 - Flags: review?(mkmelin+mozilla) → review?(jorgk)
Comment on attachment 9106116 [details] [diff] [review]
1592536-age-calculation-1.diff

In case you wonder: I had my meeting with Magnus and we decided that he focus on some more important reviews.

This works better now, but there's still a glitch:
Enter Nov 4, 1969 as birthday. Close the card, then open it again, you get 50 y/o. Correct.
Now change the year to 1970, 1971 and back down to 1968, etc. The age is adjusted accordingly. Correct.
Now with Nov 4, 1969 and 50 y/o, reduce the age to 49. Date is not adjusted. Reduce to 48, now it's adjusted, but it's off by one.
Attachment #9106116 - Flags: review?(jorgk)
Attachment #9106116 - Flags: approval-comm-esr68?
Attachment #9106116 - Flags: approval-comm-beta?

Same problem. Same solution.

Attachment #9106116 - Attachment is obsolete: true
Attachment #9106348 - Flags: review?(jorgk)
Comment on attachment 9106348 [details] [diff] [review]
1592536-age-calculation-2.diff

Thanks, I wasn't expecting any novel solution, just a complete one ;-)

I'll leave it for you to land in about six hours, I have a patch for now. Or I'll land it in 12 hours myself.
Attachment #9106348 - Flags: review?(jorgk)
Attachment #9106348 - Flags: review+
Attachment #9106348 - Flags: approval-comm-esr68+
Attachment #9106348 - Flags: approval-comm-beta+
Target Milestone: --- → Thunderbird 72.0

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/7cd9756e2aa1
Fix contact age calculation in address book. r=jorgk

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Summary: age in address book wrong calculated → age in address book wrong calculated (month calculation off by one)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: