@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
19 lines (18 loc) • 835 B
TypeScript
/**
* Convert a UTC datetime string to a plain datetime string in the format "YYYY-MM-DDTHH:mm:ss".
*
* - Converts to specified timezone before extracting datetime.
* - Defaults to UTC if no timezone specified.
* - Returns "" for invalid input.
*
* @param value UTC datetime string (e.g., "2024-02-29T00:00:00Z")
* @param options optional: timeZone (IANA)
* @returns plain datetime string in "YYYY-MM-DDTHH:mm:ss" format or "" on invalid input
*
* @example convertUtcToPlainDateTime("2024-02-29T00:00:00Z") // "2024-02-29T00:00:00"
* @example convertUtcToPlainDateTime("2024-02-29T00:00:00Z", { timeZone: "America/New_York" }) // "2024-02-28T19:00:00"
* @example convertUtcToPlainDateTime("invalid") // ""
*/
export declare function convertUtcToPlainDateTime(value: string, options?: {
timeZone?: string;
}): string;