Re: [Xsltforms-support] xsltforms date widget
Brought to you by:
alain-couthures
|
From: COUTHURES A. <ala...@ag...> - 2010-09-22 04:46:40
|
I already know that the date widget is not a bullet-proof one and I have been surprised that only few people are complaining about (you're the second one!). I have only fixed some issues in this AJAXForms inherited control. This is already a complex one because it can be customized according to user language for names of months and days but also for beginning of week. Those parameters are now defined in the config.xsl files: <properties> <!-- accessible at run time --> <language>navigator</language> <!-- navigator or default --> <calendar.day0>Mon</calendar.day0> <calendar.day1>Tue</calendar.day1> <calendar.day2>Wed</calendar.day2> <calendar.day3>Thu</calendar.day3> <calendar.day4>Fri</calendar.day4> <calendar.day5>Sat</calendar.day5> <calendar.day6>Sun</calendar.day6> <calendar.initDay>6</calendar.initDay> <calendar.month0>January</calendar.month0> <calendar.month1>February</calendar.month1> <calendar.month2>March</calendar.month2> <calendar.month3>April</calendar.month3> <calendar.month4>May</calendar.month4> <calendar.month5>June</calendar.month5> <calendar.month6>July</calendar.month6> <calendar.month7>August</calendar.month7> <calendar.month8>September</calendar.month8> <calendar.month9>October</calendar.month9> <calendar.month10>November</calendar.month10> <calendar.month11>December</calendar.month11> <format.date>MM/dd/yyyy</format.date> <format.datetime>MM/dd/yyyy hh:mm:ss</format.datetime> <format.decimal>.</format.decimal> <status>... Loading ...</status> </properties> or <properties> <!-- accessible at run time --> <language>de</language> <calendar.day0>Mo</calendar.day0> <calendar.day1>Di</calendar.day1> <calendar.day2>Mi</calendar.day2> <calendar.day3>Do</calendar.day3> <calendar.day4>Fr</calendar.day4> <calendar.day5>Sa</calendar.day5> <calendar.day6>So</calendar.day6> <calendar.initDay>0</calendar.initDay> <calendar.month0>Januar</calendar.month0> <calendar.month1>Februar</calendar.month1> <calendar.month2>März</calendar.month2> <calendar.month3>April</calendar.month3> <calendar.month4>Mai</calendar.month4> <calendar.month5>Juni</calendar.month5> <calendar.month6>Juli</calendar.month6> <calendar.month7>August</calendar.month7> <calendar.month8>September</calendar.month8> <calendar.month9>Oktober</calendar.month9> <calendar.month10>November</calendar.month10> <calendar.month11>Dezember</calendar.month11> <format.date>dd.MM.yyyy</format.date> <format.datetime>dd.MM.yyyy hh:mm:ss</format.datetime> <format.decimal>,</format.decimal> <status>... Lade ...</status> </properties> The most controversial part is about rendering and parsing: there is a customizable format forcing users to use, for example, / instead of - or to enter month before day. There shouldn't be problems when this format is strictly respected but, when not, it's trying nevertheless to recognize something using regular expressions and funny values can appear. This can be improved but I wonder if it wouldn't be better to split the input field into 3 fields for a date, for example ... I would appreciate to have pointers to good DateTime widgets (AnyTime for example) to compare with. Thank you for your feedbacks! -Alain Le 22/09/2010 01:50, C. M. Sperberg-McQueen a écrit : > I spent some time today experimenting with the date widget > used by XSLTforms. It's impressive, the way it tries to give > a culturally-expected display of the date to the user, while > serializing in ISO 8601 format, but I confess that for me, > at least, this behavior is a little unsettling (I hate the > mm/dd/yyyy date format it is using for me by default, and I > usually do my best to change the configuration of any piece of > software I can to show me dates in ISO form, or dd.mm.yyyy > form, or some form that's less prone to confusion). > > Is there a way to adjust the behavior of the widget? > > I'm also fascinated by the widget's behavior when the user > types an integer into the text field. The numbers 1, 2, > 3, 4, 5 produce, respectively, 2 Jan 2001, 3 Feb 2002, > 4 Mar 2003, 4 Apr 2004, 5 May 2005, etc. Larger numbers > (e.g. 20) seem to proceed by adding a duration of 20 > years, 20 months, and 20 days to some base date -- but > at some point something else must be happening, since when I > tested to see the behavior when you just type a year, the > value 1749 produced 15 June 1899. > > The most disturbing part of the widget, for me personally, > is that when I ignore the calendar widget and enter a date > in ISO form (I may be unusual in wanting to do this, I > know), it does not accept my ISO-form date and leave it > alone, or translate it into mm/dd/yyyy form, but treats > it as a right-associative subtraction expression, and > then converts the integer into a date. (Or so it seems; > I tried '2000-10-10' and it produces the same result as > '2000' and not the same result as '1980'.) > > I'm not sure whether any of this constitutes a bug, or just > a gap between my expectations or hopes for a date widget and > those of the AjaxForms team, or Alain. > > If this is documented somewhere, just point me to the > documentation. > |