skip to Main Content

Reactjs – Where do I put global day.js configuration in a React project so that it applies everywhere?

I want to do the following day.js configuration: import dayjs from 'dayjs'; // add plugins for timezone functionality import utc from 'dayjs/plugin/utc'; import timezone from 'dayjs/plugin/timezone'; dayjs.extend(utc); dayjs.extend(timezone); // set default timezone dayjs.tz.setDefault("America/New_York"); // set default format (source: https://stackoverflow.com/a/77459776/22134371) dayjs.extend((option,…

VIEW QUESTION

guess timezone name using javascript

I'm working on React app, I want to detect timezone like this format "Africa/Bangui", but it return it as 'Etc/GMT-1', I know it's my machine problem, since I tried the other browsers. I tried: Intl.DateTimeFormat().resolvedOptions().timeZone; dayjs guess moment guess all…

VIEW QUESTION
Back To Top
Search