question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Date.toLocaleDateString() ignores country settings on Android

See original GitHub issue
  • Provide a minimal code snippet / rnplay example that reproduces the bug.
    let testDate = Date.UTC(2016, 6, 23, 10, 0, 0, 0);
    let output = new Date(testDate).toLocaleDateString();
    return         <Text style={styles.text}>{output}</Text>;

https://rnplay.org/apps/bGMmOA

  • Provide screenshots where appropriate
  1. go to phone settings and change the language to Deutsch (Deutschland) sample_app___react_native_playground
  2. launch the app on_device

Expected:

23.06.2016

Actual:

07/23/16

  • What’s the version of React Native you’re using?

0.28

  • Does this occur on iOS, Android or both?

only Android, on iOS this works fine.

  • Are you using Mac, Linux or Windows?

Mac

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

18reactions
ljuboradoscommented, Mar 5, 2018

This definitely shouldn’t be closed. new Date().toLocaleDateString() still isn’t working correctly, and is really a basic feature.

1reaction
jayzhou215commented, Oct 24, 2017

now seems use new Date().toLocaleDateString() crash directly in android huawei phone with 1.0.0, while it is ok in ios, use new Date().toString() ok

Read more comments on GitHub >

github_iconTop Results From Across the Web

Date.prototype.toLocaleDateString() - JavaScript | MDN
The toLocaleDateString() method returns a string with a language-sensitive representation of the date portion of the specified date in the ...
Read more >
toLocaleDateString on Android returns wrong format
I use toLocaleDateString to get different date formats for different countries. But on Android then I pass, for example, 'fr-FR' or 'en-GB', ...
Read more >
Date.prototype.toLocaleDateString()
In older implementations, which ignore the locales and options arguments, the locale used and the form of the string returned are entirely ...
Read more >
en-non-US locale not causing correct date format on Mac OS X
(new Date).toLocaleDateString() seems to always return month/day/year, regardless of OS X setting. Did this work before? N/A Chrome version: 24.0.1312.52 ...
Read more >
Date.prototype.toLocaleDateString() - JavaScript
The toLocaleDateString() method returns a string with a language sensitive representation of the date portion of this date. The new locales and options...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found