Live-service games love recurring events that start at a fixed UTC time. Players, though, live in every time zone, and "the event starts at 18:00 UTC" is a common source of confusion. Here is a small, dependency-free way to show event times in the visitor's own zone.
1. Store the schedule in UTC
// Daily event windows, defined once in UTC const EVENT_WINDOWS_UTC = [ { start : "14:00" , durationMin : 60 } , { start : "20:00" , durationMin : 60 } , ] ;
Enter fullscreen mode
Exit fullscreen mode
2. Build the next occurrence as a real Date
function nextOccurrence ( { start , durationMin } , now = new Date ( ) ) { const [ h , m ] = start . split ( ":" ) . map ( Number ) ; const d = new Date ( Date . UTC ( now . getUTCFullYear ( ) , now . getUTCMonth ( ) , now . getUTCDate ( ) , h , m ) ) ; if ( d . getTime ( ) + durationMin * 60000 < now . getTime ( ) ) d . setUTCDate ( d . getUTCDate ( ) + 1 ) ; return d ; }
Enter fullscreen mode
Exit fullscreen mode
3.…