Open nlyzhov-spotnana opened 3 weeks ago
:warning: | Add or Reformat Version Info |
---|---|
:information_source: | We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2 |
:warning: | Add or Reformat Version Info |
---|---|
:information_source: | We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2 |
I think this is. bug in Hermes which implements I18n. @cortinico how can we move this to the hermes repo?
Hey @nlyzhov-spotnana, thanks for reporting this. I can reproduce the behaviour you're seeing. The issue seems to be that the timezone in Singapore changed in 1982 from +0730 to +0800. When we initially construct the date, we use the current timezone of +0800, but when converting it back to a localised string, the Intl implementation correctly uses the older timezone of +0730.
We'll look into this.
Description
Hello. Recently we got a bug for showing dates, where the date was shown with -1 day. During the investigation, the issue is found only in
Asia/Singapore
timezone and only for dates 1981 and older. The reason for this bug is thattoLocaleString
converts the timezone wrong, it gives 11.30 pm of the previous day instead of 12.00 am of the current day. This bug is only on mobile, the web shows the correct date. The date returned from (new Date('1979-01-24T00:00:00').toLocaleString() : Web: 01/24/1979, 12:00:00 AM Mobile: 01/23/1979, 23:30:00 PMSteps to reproduce
const styles = StyleSheet.create({ titleContainer: { marginTop: 100, }, });
export default function HomeScreen() { const currentDateString = new Date('2024-08-01T00:00:00').toString(); const currentDateLocale = (new Date('2024-08-01T00:00:00')).toLocaleString('en-US');
return (
); }
Stacktrace or Logs
Reproducer
https://snack.expo.dev/pJ9xRMNJBfGg39ajN7uDv
Screenshots and Videos