While working on my extension and reading discussions in #maildev, I noticed Bug 13595 – Add Birthday Fields to Address Book is still marked as NEW but has a high priority and a lot of votes in Bugzilla.  With the datepicker XUL element now available and some knowledge of the address book from working on my extension, adding a birthday field should be simple, but I have a few questions about how exactly this should appear.  This post isn’t a promise to fix this since school starts very soon and I’m trying to graduate in 3 years (1 year left after this year), but I’d like to at least get things started so somebody else can finish things up, if I am unable to do so myself.

Question #1: Which type of datepicker should be used?

There are three valid types for the datepicker element

  1. Normal – This just shows a small box that lets one type or increment/decrement the date shown with the arrows
  2. Grid – This shows a calendar and lets one click arrows to change the month (and year) and select a day from the calendar.
  3. Popup – It shows the same box as Normal, but also allows one to chose the date from a calendar like Grid does.

Notes: the two gContactSync tabs are from my extension and the Other tab isn’t necessarily going to be used; it just had the most extra room, and not all three types will be present, obviously.

Question #2 Which tab (for now)?

I know that the new/edit card dialogs might change, but which tab is best until then?  Where should it be located in the tab?

Question #3 What if the user doesn’t change the date?  How can a date be removed?

If the user doesn’t change the date, we probably do not want to save the birthday info.  Right now it only saves the date if it was changed, but there is not a way to remove the date for now.

Question #4 Store the BirthMonth as a number from 0-11 (like JavaScript does) or 1-12?

I tested LDIF import/export of the birthday information, but I remembered that JavaScript treats the month as a number from 0-11 and that is how I store the month.  Storing it as an integer from 0-11 is easiest since it is accessed through JavaScript (and shown from 1-12).

Progress

I have created an initial patch that uses a popup datepicker in the Other tab that only sets the card’s BirthDay, BirthMonth, and BirthYear if the datepicker has been updated.  It also adds the birthday to the card view in the format generated by Date.toLocaleDate()

I added BirthDay and BirthMonth to the attribute map in mailnews.js so it will export the birthday information (BirthYear is already present).  CSV and tab imports and exports BirthDay, BirthMonth and BirthYear already.

You can see my current WIP here.


4 Comments

Nikolay Shopik · August 17, 2008 at 2:40 AM

Popup, because it save us space when not needed.

Standard8 · August 17, 2008 at 5:01 PM

We really, really, really want this in TB (its on the TB 3 blocker list).

Maybe you could get this working in your extension and then move the code across to TB?

If you want more input, then I suggest posting to m.d.a.thunderbird where you’ll also hopefully pick up comments from our User Experience guy, Bryan Clark.

Bill · September 7, 2008 at 10:29 AM

Popup on “Other” tab.

Add a “Clear Date” button so the user can clear the date. Can the datepicker control be blank to start with?

pi · September 7, 2008 at 12:11 PM

I don’t think that the datepicker can be blank because it throws an exception “Error: uncaught exception: Invalid Date”

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.