Date Format?

Adam Peller apeller at
Thu Apr 17 20:46:42 PDT 2008

Garrett wrote:
> Properly formatting dates, solution (1), in ES is a lot of work.

Indeed it is.  A couple of Javascript toolkits have taken a crack at this
problem and provide pluggable, reusable solutions you may want to look at
(e.g. Dojo's and datejs available from Google code)  There
are several facets to this problem.  First there is the parsing and
formatting logic, basically string and regexp operations which are not
unreasonable to delegate to a toolkit.  Another is maintaining the large
translation tables needed to provide this function (communities like the
in have taken this on in open source -- there's no reason
why you should have to build your own translations).  Then there is the
mechanism to embed and load the appropriate resources.  Note that this is
essentially a package loading problem which is not unique to Dates, and
leverages its package loader to load locale-sensitive information like
date formats.  I think this part is most challenging to provide in
Javascript, but appears to be outside the scope of ES4.

The current ES4 Date proposal provides unambiguous ISO formats which should
encourage better programming practices.  That seems like the right place to
start.  Hard-coding mm/dd/yyyy is just as bad as hard-coding English
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Es4-discuss mailing list