Open
Description
Describe the bug
The Timezone plugin returns incorrect values or null on iOS when Hermes engine is enabled.
Information
- Day.js: 1.11.7
- OS: iOS
- React Native: 0.71
- Time zone: GMT+01:00
Steps to reproduce
npx react-native init AwesomeProject
yarn add dayjs
Code example
import React from 'react';
import {SafeAreaView} from 'react-native';
import dayjs from 'dayjs';
import timezoneDayjsPlugin from 'dayjs/plugin/timezone';
import utcDayjsPlugin from 'dayjs/plugin/utc';
dayjs.extend(utcDayjsPlugin);
dayjs.extend(timezoneDayjsPlugin);
const App = () => {
// #1 Converting to a timezone
const timestamp = '2013-11-18 11:55';
const tz = 'Asia/Taipei';
console.log(
'Converting to a timezone',
dayjs
.utc('2013-11-18 11:55')
.tz('Asia/Taipei')
.format(),
);
// #2 Parsing in a timezone
console.log(
'Parsing in a timezone',
dayjs.tz(timestamp, tz).format(),
);
return <SafeAreaView />;
};
export default App;
Actual behavior
LOG Converting to a timezone Invalid Date
LOG Parsing in a timezone 2013-11-18T12:08:00+07:55
Expected behavior
LOG Converting to a timezone 2013-11-18T19:55:00+08:00
LOG Parsing in a timezone 2013-11-18T11:55:00+08:00
For React Native < 0.70 timezone plugin doesn't work at all, right now it works but returned values are incorrect.
Metadata
Metadata
Assignees
Labels
No labels