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

Date.prototype.toLocaleDateString crashes App on Android when Date value is negative #31005

Closed
Yonom opened this issue Feb 17, 2021 · 1 comment
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@Yonom
Copy link
Contributor

Yonom commented Feb 17, 2021

Description

On Android devices, calling the Date.prototype.toLocaleDateString() function with a date that is earlier than 1900-01-01 crashes the app.

React Native version:

System:
OS: macOS 11.2
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 708.55 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.5.3 - ~/.nvm/versions/node/v14.15.3/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 24, 29
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_282 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: ~0.63.4 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

  1. Create a new React Native 0.63.4 project
  2. Paste the following code somewhere where it's executed:
try {
  new Date('1899-12-31').toLocaleDateString('en');
} catch {}

Expected Results

The app does not crash when it is opened on Android.

Snack, code example, screenshot, or link to a repository:

https://snack.expo.io/@yonom/grumpy-cookies

@Yonom
Copy link
Contributor Author

Yonom commented Feb 3, 2022

Issue is resolved. Tested on React Native 0.66.4

@Yonom Yonom closed this as completed Feb 3, 2022
@facebook facebook locked as resolved and limited conversation to collaborators Feb 3, 2023
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants