Are there any plans to introduce Date/Time literals?

Andrew Fedoniouk news at terrainformatica.com
Wed Oct 9 17:27:54 PDT 2013


I understand that in "normal" JS code date literals are kind of not
needed.  As probably in any other programming language where date
values are coming from external sources, e.g. from DB/persistent
storage.

But JS/ES is quite unique in this respect. It's data literals *are*
used as a form of persistence, and  quite a lot. Think of JS derived
syntax constructs like JSON or MongoDB query language.

If tomorrow JSON2 will appear it will come up with its own date
literals. And suddenly you will not be able to use eval() to parse
JSON. I know that eval() ideally should not be used to parse JSON but
nevertheless. I believe that it is beneficial for many reasons for the
language to include transport format (e.g. JSON literals) as part of
base syntax.



On Wed, Oct 9, 2013 at 8:29 AM, Brendan Eich <brendan at mozilla.com> wrote:
> Andrew Fedoniouk wrote:
>>>
>>> http://wiki.ecmascript.org/doku.php?id=discussion:date_literal_syntax
>>> >
>>> >  http://wiki.ecmascript.org/doku.php?id=proposals:date_literal_syntax
>>> >
>>> >
>>> > https://encrypted.google.com/#q=site:https%3A%2F%2Fmail.mozilla.org%2Fpipermail%2Fes-discuss%2F+%22date+literal%22
>>> >
>>
>>
>> Thanks for links but what is the conclusion?
>
>
> No date literals in JS. Not worth their weight, most Dates are not expressed
> as hardcoded date strings. If you need it, use an ES6 template string.
>
> /be



-- 
Andrew Fedoniouk.

http://terrainformatica.com


More information about the es-discuss mailing list