@open-rlb/date-tz
Version:
A lightweight JavaScript/TypeScript date-time utility with full timezone support, custom formatting, parsing, and manipulation features.
52 lines (51 loc) • 1.74 kB
TypeScript
import { IDateTz } from "./idate-tz";
export declare class DateTz implements IDateTz {
timestamp: number;
timezone: string;
private _timezoneOffset;
private _isDst;
static defaultFormat: string;
constructor(value: IDateTz);
constructor(value: number, tz?: string);
isComparable(other: IDateTz): boolean;
compare(other: IDateTz): number;
toString(): string;
toString(pattern: string): string;
toString(pattern: string, locale: string): string;
add(value: number, unit: 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year'): IDateTz;
cloneToTimezone(tz: string): DateTz;
setTimezone(tz: string): IDateTz;
stripSecMillis(): IDateTz;
set(value: number, unit: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'): this;
get year(): number;
get yearUTC(): number;
get month(): number;
get monthUTC(): number;
get day(): number;
get dayUTC(): number;
get hour(): number;
get hourUTC(): number;
get minute(): number;
get minuteUTC(): number;
get dayOfWeek(): number;
get dayOfWeekUTC(): number;
get timezoneOffset(): number;
get isDst(): boolean;
get isLeapYear(): boolean;
private _isLeapYear;
private daysInYear;
private _year;
private _month;
private _day;
private _hour;
private _minute;
private _dayOfWeek;
private static _supportedTimezones;
private static _timezones;
static parse(dateString: string, pattern?: string, tz?: string): DateTz;
static now(tz?: string): DateTz;
static timezones(): string[];
static supportedTimeZones(): string[];
private static fallbackTimeZone;
private static isValidTimeZone;
}