[Dojo-interest] Problem with date formatting

Adam Peller peller at gmail.com
Thu Apr 30 13:29:59 EDT 2009


On Thu, Apr 30, 2009 at 12:00 PM, "Renaud BINSE"
<r.binse at cadresonline.com> wrote:
> I have a little problem with date formatting. This code doesn't return
> the same value with Internet Explorer 7.0 and Firefox 3, french
> version... Of course, it's wrong with IE :(
> ...
> Result :
> Firefox : Tue Dec 30 2008 00:000:000 GMT+0100
> IE 7.0 : Tue Dec 30 00:00:00 UTC+0100 2008

That's the point of dojo.date.stamp.  fromISOString converts from
"ISO" format to a Date object.  Date.toString() is undefined and will
not be consistent across browsers, platforms or locales.  Date objects
are useful for interacting with JavaScript, but if you wish to
serialize a date you should keep it in ISO format.  If you want a
consistent user presentation of a Date that is sensitive to locale,
you should use dojo.date.locale.

> In fact, I'd like to send date with xhrPost and dijit.form.DateTextBox
> and I really don't know how to solve this... It's possible to deal with
> this on the server, but....

DateTextBox should send back the ISO format as the value of the form element.

-Adam


More information about the Dojo-interest mailing list