Questions tagged [date-fns-tz]

10 questions
2
votes
2 answers

How to get a start of day date in specific timezone

I am working with Date Picker component and I am trying to get selected day from date picker to be start of day (midnight) in specific timezone (e.g. Europe/London). So for example if I select 2023-01-30 I want to get something like Mon Jan 30 2023…
2
votes
1 answer

"Invalid time zone specified" with date-fns-tz in React Native

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…
remyremy
  • 3,548
  • 3
  • 39
  • 56
1
vote
1 answer

getting updated timezone information in nodejs and types of libraries involved

With regard to my previous question on how to manage timezone specific date as well as manage their conversions, I have been trying to think of a way to be able to get updated timezone information that reflects the latest possible data of the iana…
juztcode
  • 1,196
  • 2
  • 21
  • 46
0
votes
0 answers

Formatting timestamp using date-fns-tz keeps returning 1970

I have a timestamp which is being returned from Stripe which is 1695112577 ... If i punch it into https://www.epochconverter.com/ it returns the correct date Tuesday, 19 September 2023 But if i try and use date-fns-tz to convert it, it keeps…
CodeSauce
  • 255
  • 3
  • 19
  • 39
0
votes
1 answer

date-fns showing invalid interval when comparing dates using isWithinInterval and a users timezone

I am getting back UTC time from an API, so in my next project, i am converting the UTC times to the users local time based on a timezone setting coming also from the API. I am trying to use the isWithinInterval function of date-fns to check if the…
CodeSauce
  • 255
  • 3
  • 19
  • 39
0
votes
0 answers

Format timezone as PST, EST, etc for date-fns

I'm using date-fns to format my date objects when displaying to the user. I need to display their local timezone but I want it to display timezones as PST, or EST, etc., but all I get are GMT-4, GMT-7, etc. Right now my format string…
dokgu
  • 4,957
  • 3
  • 39
  • 77
0
votes
0 answers

How to get timezone abbreviation with date-fns-tz?

I have an ISO string in UTC from my backend and I want to format it to particular timezone so I am using date-fns-tz for that as recommended in the docs But when I try to print the date with timezone abbreviation token, I get the GMT+/-x instead of…
Prateek Surana
  • 672
  • 9
  • 29
0
votes
2 answers

How do I get the number of milliseconds to the next day of the local timezone using date-fns-tz?

Similar to Incrementing a date in JavaScript but I am looking for the number of milliseconds to the next day given a timezone. This is so that I can trigger a subscription or React state change when the local time reaches midnight. The function…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
0
votes
0 answers

Issue: date-fns adds 'random' timezone on my time_stamp

I am using ReactJS with NextJS and i receive some data from the API. This variables look alike with what i receive from api. const timeStampOne = 2022-06-27T18:59:33.410430Z; const timeStampTwo = 2021-02-11T09:36:05Z; const dateConverter = () =>…
Iv.Angelo
  • 1
  • 1
  • 1
-1
votes
1 answer

Date-FNS Timezone Abbreviation

How do I convert the Australian Eastern Daylight Time to just AEST? Currently it outputs like 11/11/2022 15:29:25 Australian Eastern Daylight Time. Expected output would be like 11/11/2022 15:29:25 AEDT import { formatInTimeZone } from…
Joseph
  • 7,042
  • 23
  • 83
  • 181