In the Struts application I'm developing I need to support
European date formats in the popup calendar, which
means I need to support the "." between the month,
day, year (e.g.: MM.DD.YYYY). I also need to support
day, month, year order format, too (e.g. DD-MM-YYYY).
For this second example, the calendar is behind
password so I know the user's Date Format preference. I
then set it to equal the JavaScript
variable "calDateFormat". When the user clicks on the
popup and clicks on their desired date, the date is
written correctly back into the input field. So far, so
good. However, if the user clicks on the popup again,
the calendar reads the value in the field backwards (that
is, as MM.DD.YYYY) and then jumps the calendar
ahead or behind based on this inverted value.
For example: the user's date format preference is DD-
MM-YYYY. They select 25 March, 2003 in the popup
and the date is written to the input field as 25-03-2003.
If the user clicks on the popup calendar again, the
Calendar jumps ahead to January of 2005 with the 3rd
day highlighted. Obviously the popup calendar is seeing
the 25 as the month and is jumping the user ahead 25
months from the beginning of 2003 - hence January,
2005. And the 3 is highlighted because it doesn't see
the "03" as March, it sees it as the 3rd day.
Anyway, I cannot figure out how to write some custom
code so that it supports both of the example European
formats, particularly the DD-MM-YYYY format. Do you
have any suggestions?