Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not standard date.toString() format #38

Closed
nes123 opened this issue Jul 15, 2019 · 4 comments
Closed

not standard date.toString() format #38

nes123 opened this issue Jul 15, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@nes123
Copy link

nes123 commented Jul 15, 2019

(new Date).toString()

results in "2019-07-15T20:29:57.312+03:00"

instead of the familiar javascript format:

Mon Jul 15 2019 20:29:57 GMT+0300 (IDT)

any ideas how I can enforce the familiar javascript format instead of this new one as it is not compatible with my code?

@mhorowitz
Copy link
Contributor

Our current implementation matches the ES6 spec, which allows the implementation a lot of flexibility. But, ES9 is more strict, and requires output like the familiar form you show.

We'll work on updating our implementation, but until then, (new Date).toLocaleString() may give you something more friendly to your purpose.

@mhorowitz mhorowitz added the enhancement New feature or request label Jul 15, 2019
@danilobuerger
Copy link

@mhorowitz The ES6 spec states:

Return an implementation-dependent String value that represents tv as a date and time in the current time zone using a convenient, human-readable form.

A string in ISO 8601 isn't really a "convenient, human-readable form". So, arguably, this is not spec compliant.

@avp
Copy link
Contributor

avp commented Jul 25, 2019

The ES9.0 compliant version of Date.prototype.toString was added in a38ec5f.

@avp avp closed this as completed Jul 25, 2019
@ljharb
Copy link

ljharb commented Jul 25, 2019

(ES2018; the edition number isn't used after ES6 / ES2015)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants