iamkun / dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
https://day.js.org
MIT License
46.65k stars 2.28k forks source link

The timezone plugin is not compatible with React Native Hermes engine #1377

Open dortamiguel opened 3 years ago

dortamiguel commented 3 years ago

The timezone plugin throws a timezone RangeError error when calling .tz because React Native Hermes engine doesn't has support for Intl timezones and toLocaleString

This two lines are the ones that are throwing the error

https://github.com/iamkun/dayjs/blob/dev/src/plugin/timezone/index.js#L20

https://github.com/iamkun/dayjs/blob/dev/src/plugin/timezone/index.js#L98

Could be posible to update the plugin to not depend on Intl and toLocaleString('en-US', { timeZone: timezone }) ?

shuo-hiwintech commented 1 month ago

+1

shuo-hiwintech commented 4 days ago

I ended up replacing dayjs with moment, and moment worked fine in rn switching timezones.