A scheduler that works in UTC and converts only at display time is the standard advice. It is also wrong for a subset of cases: recurring events that the user intends to happen at a local time regardless of DST shifts.
Store the intent, not the instant
For a one-off event, store a UTC timestamp. For a recurring event, store the local time plus the IANA zone:
interface RecurringEvent { localTime : string ; // "14:30" tz : string ; // "Australia/Sydney" rrule : string ; // "FREQ=DAILY" }
Enter fullscreen mode
Exit fullscreen mode
When computing the next occurrence, resolve localTime in the given zone at that future date β not today's offset:
import { DateTime } from 'luxon' ;
function nextOccurrence ( event : RecurringEvent ) : DateTime { const now = DateTime . now ( ) . setZone ( event . tz ) ; let next = now . set ( { hour : 14 , minute : 30 , second : 0 } ) ; if ( next <= now ) next = next .β¦