akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.3k stars 952 forks source link

Datepicker and calendar returning UTC date on hermes #1439

Open gorbypark opened 3 years ago

gorbypark commented 3 years ago

🐛 Bug Report

When running UI Kitten on Hermes (both iOS and Android) the returned date from the datepicker and calendar components is UTC formatted, while on non-Hermes engines (JSC and web) the date is returned in the local time zone. This is most likely due to the lack of intl support in Hermes.

To Reproduce

Pick a date using Datepicker or Calendar using Hermes.

Expected behavior

In my opinion, I think the components should return a consistent date across all platforms. Ideally, a polyfill could be created to support returning local timezone dates on Hermes.

UI Kitten and Eva version

Package Version
@eva-design/eva 2.1.0
@ui-kitten/components 5.1.0

Environment information

  System:
    OS: macOS 11.4
    CPU: (4) x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
  Binaries:
    Node: 14.17.0 - /usr/local/opt/node@14/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/opt/node@14/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.2
      System Images: android-29 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild
artyorsh commented 3 years ago

It's a known issue. See https://github.com/facebook/hermes/issues/23

With Hermes, you can use date-fns + @ui-kitten/date-fns packages

gorbypark commented 3 years ago

Ok, thanks for the suggestion. There seems to be a lack of information on how to actually use the @ui-kitten/date-fns package. I've tried the follow:

I get no error but the output of Calendar is still the same UTC based date as before..picking May 31 for example on Hermes and with @ui-kitten/date-fns gives me 2021-05-30T22:00:00.000Z while on jsc/web I get Mon May 31 2021 00:00:00 GMT+0200 (Central European Summer Time).