-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Question: Date formatting in util.js/inspect
#4314
Comments
Good question. That is rather wacky. Personally I'd prefer using the @Xotic750 ... interested in opening a PR with a possible fix that can be reviewed? |
I think I could do that, I will go with |
Landed in 04af258, thank you! |
Xotic750
added a commit
to Xotic750/node
that referenced
this issue
Dec 17, 2015
Re: nodejs#4314 `Inspect` formats dates in two different ways, depending on whether it has properties or not. No properties and it uses `toString`. https://github.com/nodejs/node/blob/master/lib/util.js#L272 > The toString() method always returns a string representation of > the date in American English. While when properties are present it uses `toUTCString`. https://github.com/nodejs/node/blob/master/lib/util.js#L393 > The format of the return value may vary according to the platform. > The most common return value is a RFC-1123 formatted date stamp, > which is a slightly updated version of RFC-822 date stamps. I am wondering why two different representations are used? And being 2015, it would seem sensible to use `toISOString`. > The toISOString() method returns a string in simplified > extended ISO format (ISO 8601), which is always 24 characters > long: YYYY-MM-DDTHH:mm:ss.sssZ. The timezone is always zero > UTC offset, as denoted by the suffix "Z". ./configure make test Total errors found: 0
cjihrig
pushed a commit
that referenced
this issue
Dec 17, 2015
Fix: #4314 PR-URL: #4318 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
scovetta
pushed a commit
to scovetta/node
that referenced
this issue
Apr 2, 2016
Fix: nodejs#4314 PR-URL: nodejs#4318 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspect
formats dates in two different ways, depending on whether it has properties or not.No properties and it uses
toString
https://github.com/nodejs/node/blob/master/lib/util.js#L272
While when properties are present it uses
toUTCString
https://github.com/nodejs/node/blob/master/lib/util.js#L393
I am wondering why two different representations are used?
And being 2015, it would seem sensible to use
toISOString
Anyway, I look forward to hearing the logic behind the decision and better my understanding.
The text was updated successfully, but these errors were encountered: