Are there any plans to introduce Date/Time literals?

Oliver Hunt oliver at
Wed Oct 9 09:46:39 PDT 2013

On Oct 9, 2013, at 1:35 AM, Claude Pache <claude.pache at> wrote:

> Le 8 oct. 2013 à 23:43, Andrew Fedoniouk <news at> a écrit :
>> Quite often Date values are used in data exchanges in form of JS
>> literals or JSON.
>> It would be beneficial if JS (and JSON as derivative) will have an
>> ability to represent dates literally  . For example:
> Even if there had been a dedicated syntax to write literal dates in JS, it doesn't mean that JSON would have allowed such a representation.
> For instance, the following entities have literal representation in JS, but do not exist in JSON, by the will of its designer: Infinity, NaN, and regular expressions.

Infinity and NaN a identifiers referencing properties on the global object — they’re not literals (nor is undefined).

These are all valid (but you shouldn’t do it):

function f(undefined, NaN, Infinity) {
// dooooooommmmmm

function f() {
var undefined = null /* fix that silly null vs. undefined shenanigans */, NaN = Math.sqrt(2) /* make sure nan is not rational */, Infinity = 10000000 /* this should be big enough */


More information about the es-discuss mailing list