2

I have an Expo project and use date-fns and date-fns-tz to manipulate time and timezones.

Regarless of the timezone I use (Europe/Paris, UTC, America/New_York'...), I get the following error:

Invalid time zone specified: Europe/Paris

I've tried to copy/paste the example from the documentation, but same thing.

Here is a code snippet:

import { formatDuration, intervalToDuration, parseISO } from "date-fns";
import { formatInTimeZone} from "date-fns-tz";
formatInTimeZone(
      date,
      "Europe/Paris",
      "yyyy-MM-dd HH:mm:ssXXX"
    );

I've tried the solution described here but my app gets errors.

Using "date-fns": "^2.16.1" and "date-fns-tz": "^1.3.7".

remyremy
  • 3,548
  • 3
  • 39
  • 56

1 Answers1

0

i had the same problem with react-native(CLI) and doesn`t achieved to resolve the problem. I saw something about a version of hermes, I think in react-native 0.59 or higher this is solved.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 17 '23 at 14:01