import { DateTime, TimeZone } from 'timezonecomplete'; export class TimeConverter { static toUtcDatetime = ( date: string, time: string, timezone: string, ): Date => { try { return new Date( new DateTime(`${date}T${time}:00`, TimeZone.zone(timezone, false)) .convert(TimeZone.zone('UTC')) .toIsoString(), ); } catch (e) { return undefined; } }; }