[whatwg] Date Update?

Jasper St. Pierre jstpierre at mecheye.net
Sun Jan 19 10:01:09 PST 2014

On Sun, Jan 19, 2014 at 12:22 PM, Rick Waldron <waldron.rick at gmail.com>wrote:

> Garrett,
> I'm cc'ing es-discuss, as that's a more appropriate list for discussing
> updates and extensions to the language's built-in objects.
> Rick
> On Sunday, January 19, 2014, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
> > Hi All -
> >
> > Just some random ideas on JavaScript Date. I understand that it was
> > copied from Java. Was this based on the requirement to “look like
> > Java” on the typical appeal to popularity marketing tact? (Java was
> > hot back then).
> >
> > What considerations are there for codifying the behavior for
> > Date.parse? Middle endian date format parsing works:
> > Date.parse("2/11/2013"); Should this be standardized here:
> > http://javascript.spec.whatwg.org/#date
> >
> > Any proposals for Date.prototype.format, ala strftime?
> >
> > Any replacement proposals, like a Joda-Time, or others, that treat a
> > Date as a set of fields rather than an object represented by a number?
> > And maybe with add/subtract methods without having to resort to each
> > field? Zero-based month and one-based days are weird, but even weirder
> > with MakeDay adding the extra month onto the year field:
> >
> > var d = new Date(Date.now())
> > d.setMonth(12); // Next January, not December.

Date is a wrapper for a UNIX timestamp. It's not designed to be an accurate
calendaring API. I feel like a calendering API should be related to Date
and integrate with it, but a separate API altogether.

Computer representations of date and time are complicated enough, and
should we want a standard calendering API, it should be done by not
wrapping a UNIX timestamp.

> > Any proposal to get the user's preferred date format?

Well, it depends on what you mean by this. Do you mean a string that you
can pass to a strftime equivalent, conveniently formatted for the user to
represent a specific date? e.g. "Today is 1/19/2014". Would it allow for
the user to set something like "Today is January 19th, 2014"? It seems like
this is fairly close to i18n concerns. A use case of how you would use it
would be helpful.

> --
> > Garrett
> > @xkit
> > ChordCycles.com
> > garretts.github.io
> >


More information about the whatwg mailing list