Date-FNS Timezone Abbreviation

693 Views Asked by At

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 'date-fns-tz'
import auLocale from 'date-fns/locale/en-AU'

formatInTimeZone(
        new Date(value),
        'Australia/Sydney',
        'dd/MM/yyyy HH:mm:ss zzzz',
        { locale: auLocale }
      )
1

There are 1 best solutions below

0
On BEST ANSWER

Use zzz for the format of the timezone instead of zzzz.

Sample: 'dd/MM/yyyy HH:mm:ss zzzz'