Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 '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 }
      )

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading