To convert GMT to Australian Eastern Time (AET) in TypeScript, you can use Moment.js, a popular JavaScript library for handling dates and times.
Assuming you have a date string in GMT format, you can convert it to AET as follows:
index.ts277 chars7 lines
In the above code:
moment-timezone library to use its API for handling timezones.gmtDateStr variable that holds the date string in GMT format.gmtDateStr using the moment.tz function that sets the timezone to GMT.tz function again with the timezone string 'Australia/Sydney'.format function and a format string YYYY-MM-DD HH:mm:ss z, which shows the year, month, day, hour, minute, second, and timezone abbreviation.Note that the above code assumes that you have the Moment.js library installed in your project. You can install it using npm install moment-timezone command.
gistlibby LogSnag