Closed BurgerZ closed 11 months ago
I cannot reproduce this in the iOS 16.4 simulator.
I cannot reproduce this in the iOS 16.4 simulator.
Try this Expo snack - https://snack.expo.dev/@burgerz/luxon-datetime-issue
On web and Android it works well, but on iOS it shows just null
instead of actual DateTime for Asia/Kolkata
.
Luxon uses Intl.DateTimeFormat
to provide its localization and time zone data.
React Native uses Hermes normally, not the default iOS WebView. Hermes' implementation of Intl.DateTimeFormat
is unfortunately quite buggy and incomplete.
In this case, new Intl.DateTimeFormat(undefined, { timeZone: 'Asia/Kolkata' })
throws under Hermes ("incorrect timeZone information provided"). You'll have to report a bug to Hermes.
Additionally I want to add, that DateTime.now()
does not in fact return null. It returns an invalid DateTime
. toISO
on an invalid DateTime then produces null (because it has nothing else reasonable to show). If you inspect the invalid DateTime
(DateTime#invalidReason
) you will see that Luxon correctly reports "unsupported zone", because your platform does not support the time zone you requested.
Describe the bug
DateTime.now()
returnsnull
if you try to set the timezone ofAsia/Kolkata
. It's not throwing any errors, just returnsnull
.To Reproduce
Resulting log entry:
date: null
Actual vs Expected behavior Expecting that it will result the actual date in selected time zone:
Output should be something like:
date "2023-08-17T18:09:09.866+02:00"
Desktop (please complete the following information):
Additional context