UNPKG

@kadconsulting/dry

Version:
39 lines (38 loc) 2.27 kB
/** * Converts a given date to the specified time zone, only if it's not already in that time zone. * @param {Date | string | number} date - The date to be converted. * @param {string} timeZone - The target time zone. * @returns {Date} - The converted date as a Date object. */ export declare const convertToTimeZoneIfNeeded: (date: Date | string | number, timeZone?: string) => Date; export declare const formatDateToLocaleString: (date: Date | number) => string; export declare const formatDateToLocaleStringFromISO: (isoDateStr: string) => string; export declare const formatDateToLocaleAmPmStringFromISO: (isoDateStr: string) => string; export declare const formatBookingDateTime: (bookingDateTime: string, format?: string, timeZone?: string) => string; /** * Converts a given Denver time date string to a UTC ISO string with the time preserved. * * @param {string} dateString - The date string in "MM/DD/YYYY HH:mm" format, assumed to be in Denver time. * @returns {string} - A UTC ISO string with the time preserved as in the input. */ export declare const convertDenverTimeToISOWithTimePreserved: (dateString: string) => string; export declare const convertTimeToISO: (timeString: string) => string; export declare const removeTimezoneFromISO: (isoString: string) => string; /** * Appends UTC designator to a given time string without altering the time. * * @param {string} timeString - The time string in "HH:mm:ss" format. * @returns {string} - The input time string with UTC timezone information appended. */ export declare const convertTimeToUTC: (timeString: string) => string; export declare const addDurationToDateTime: ({ startDateTime, duration, }: { startDateTime: string; duration: number; }) => string; export declare const convertToDenverTime: (date: Date) => string; export declare const formatTimeString: (dateTimeString: string) => string; export declare const convertTime: (timeString: string | null) => string | null; export declare const formatTimeStringWhole: (dateTimeString: string) => string; export declare const convertToDenverTimeWithAmPM: (dateTimeString: string | null) => string | undefined; export declare const formatDate: (dateString: string) => string; export declare const isoUtc: (isoString: any) => Date;