dt-i18n
Version:
A lightweight, modular JavaScript/TypeScript date and time utility with built-in internationalization (i18n) support for many languages.
18 lines (17 loc) • 562 B
TypeScript
export interface DateParts {
year: number;
month: number;
dayOfMonth: number;
dayOfWeek: number;
hours: number;
minutes: number;
seconds: number;
}
/**
* Gets the components of a date, optionally adjusted for a specific timezone.
* This function is the core of our timezone logic.
* @param date The input Date object.
* @param timezone An optional IANA timezone string (e.g., 'America/New_York').
* @returns An object containing the date parts.
*/
export declare function getDateParts(date: Date, timezone?: string): DateParts;