Convert dates to a specific timezone during formatting
Use the
tz option within the format() function to display a date from the perspective of a specific timezone. For example, a UTC date can be converted to 'America/New_York' time during the formatting process.import { format } from '@formkit/tempo'
format({
date: new Date('2021-01-01T00:00:00Z'),
tz: 'America/New_York',
format: 'YYYY-MM-DD HH:mm:ss'
})
// Output: 2020-12-31 19:00:00