Skip to content

Change in behavior of Date.toLocaleDateString() in version 4.2.3 #4159

Description

@scottbrady

I upgraded from version 4.2.2 to version 4.2.3 and noticed a change in the behavior of toLocaleDateString.

This code returns a different string between the two versions:

new Date('2014/09/05').toLocaleDateString()

4.2.2: Friday, September 05, 2014
4.2.3: 9/5/2014

I don't see any notes in the changelog that would suggest this behavior would change.

I'm installing nodejs on Ubuntu Precise using the packages from NodeSource.

Activity

  1. added
    i18n-apiIssues and PRs related to Node.js internationalization support.
    on Dec 4, 2015
  2. ChALkeR commented on Dec 4, 2015

    @ChALkeR
    Member

    /cc @srl295, I guess.

  3. evanlucas commented on Dec 5, 2015

    @evanlucas
    Contributor

    Interesting, I'm getting the same on OS X for those versions.

    screen shot 2015-12-05 at 8 47 47 am

    Can you try running node -pe process.versions.icu on both versions?

  4. targos commented on Dec 5, 2015

    @targos
    Member

    I have the same result as @evanlucas on Fedora 23

  5. bnoordhuis commented on Dec 5, 2015

    @bnoordhuis
    Member

    If I had to venture a guess, it would be that the NodeSource packages weren't built with ICU support until v4.2.3. "Friday, September 05, 2014" is the formatting for non-i18n builds, "9/5/2014" for small-icu (English only) builds.

    It shouldn't affect the binaries from https://nodejs.org/dist/v4.2.2/, those have been built with small-icu for some time now.

  6. scottbrady commented on Dec 5, 2015

    @scottbrady
    Author

    Results from running node -pe process.versions.icu.

    4.2.2: undefined
    4.2.3: 56.1

    Looks like something changed with ICU in the NodeSource build of nodejs packages from version 4.2.2 to 4.2.3.

  7. scottbrady commented on Dec 5, 2015

    @scottbrady
    Author

    Probably related to this issue: nodesource/distributions#168

    Looking at the output of process.config between NodeSource's packaged versions shows the icu library being compiled in starting with 4.2.3.

  8. ChALkeR commented on Dec 5, 2015

    @ChALkeR
    Member

    I don't think that there is anything actionable here, in both cases the method behaves as it should, given the build configuration. Also, this is not related to builds on nodejs.org. Can we close this?

  9. scottbrady commented on Dec 5, 2015

    @scottbrady
    Author

    Looks like a change in NodeSource's compilation process, not a change in Node proper. Closing. Thanks!

  10. rvagg commented on Dec 7, 2015

    @rvagg
    Member

    Yes, sorry, it's to do with a change that was made in the compilation process. We have been building without ICU until now and just turned it on. Frankly it was an oversight and we were keen to rectify it as soon as we became aware of it. The binaries you get from the NodeSource Linux distributions should now be equivalent to the ones available for download at nodejs.com except they are compiled with the appropriate toolchain for each distribution.

    /cc @chrislea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    i18n-apiIssues and PRs related to Node.js internationalization support.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions