Thursday, 18 March 2010

Exploring a Domino Date Bug

I've been exploring a date issue that landed on my desk earlier in the week.   That's one of the joys of being an Administrator that has a handle on how to develop web applications in Lotus Domino.

I'll set the scene.

  1. The client has a dual language system.  English and French.  They can choose in the application whether a particular user sees the English or French interface.
  2. Some users use an English browser, some use a French browser.  It's their choice.
  3. The client has a preferred date format.  In the English interface, it is MMM-DD-YYYY.  The MMM could be 'Jan' for January, 'Feb' for February or 'Mar' for March.  In the French interface, it is basically the same, but uses French language abbreviations.  'janv.' for January, 'fev.' for February, 'mars' for March.
There are 4 different usage scenarios.
  1. English interface, English browser
  2. English interface, French browser
  3. French interface, French browser
  4. French interface, English browser
They all work perfectly but one.  Number 2.  And only for a select few dates.

If you switch your Regional Settings to 'French (Canada)', and you are using the English interface of the application, and you enter a date like 'Mar-01-2010', Domino will store the date as '01/01/2010' (the server's date settings are mm/dd/yyyy).

It gets more interesting, if you enter 'Mar-08-2010', the date gets stored as '08/01/2010', yes, that's right, August 1st, 2010.

I ran some tests, and discovered the following, using the French regional settings and the English date format:
  1. The month of January ('Jan-01-2010' through 'Jan-31-2010') stores the correct date.
  2. The month of Febrary ('Feb-01-2010' through 'Feb-28-2010') stores the correct date.
  3. The month of March ('Mar-01-2010' through 'Mar-12-2010') stores the incorrect date.
  4. The month of March ('Mar-13-2010' through 'Mar-31-2010') stores the correct date.
  5. The month of April ('Apr-01-2010' through 'Apr-30-2010') stores the correct date.
  6. The month of May ('May-01-2010' through 'May-31-2010') stores the correct date.
  7. The month of June ('Jun-01-2010' through 'Jun-30-2010') stores the correct date.
  8. The month of July ('Jul-01-2010' through 'Jul-31-2010') stores the correct date.
  9. The month of August ('Aug-01-2010' through 'Aug-31-2010') stores the correct date.
  10. The month of September ('Sep-01-2010' through 'Sep-30-2010') stores the correct date.
  11. The month of October ('Oct-01-2010' through 'Oct-31-2010') stores the correct date.
  12. The month of November ('Nov-01-2010' through 'Nov-30-2010') stores the correct date.
  13. The month of December ('Dec-01-2010' through 'Dec-31-2010') stores the correct date.
So, it's only the first 12 days of March that cause an issue.  And it doesn't matter what the year is.

What causes this?
I've spoken with IBM support, and one of the application developers, and here is why it is happening:
Depending on your server settings (either on the Server document or in your Internet Site document.  See fig 1.), the server will either use the Server's regional locale, or the browser's accept-language.

Fig 1. Internet Site Document

In this case, it is using the browser's accept-language.  When you change your regional locale on your computer (Windows in this case) the accept-language of your browser changes too (Internet Explorer in this case).  Domino looks at the incoming date format ('MMM-DD-YYYY') and determines that it is not an acceptable date format for that accept-language.  The date ends up getting recorded incorrectly.

The part that confuses me, is why does 'Mar-13-2010' get recorded correctly, and 'Mar-12-2010' and earlier not get recorded correctly?  (For reference, 'Mar-12-2010' gets recorded as '12/01/2010'.)

What I've done
I've asked IBM for a fix, so we will see what will come of that.

The affected versions that I have tested are:
  • Lotus Domino 8.5FP1
  • Lotus Domino 6.5.6FP3
I'm guessing that this is also an issue in anything that falls between these.

Why this is important to me?
I'm from Canada.  We're a bilingual society where people can work in the language they prefer.  In this case, someone whose browser (and complete operating system) is in French, prefers to work with the English interface because it is easier to communicate with their co-workers who are English.

At this point I either have to:
  1. Force the user to work in the French interface. (Not going to happen.)
  2. Recode every document save to translate the date entered as 'Mar-DD-YYYY' to '03/DD/YYYY' before saving.
  3. Hope that IBM will release a fix for me.