dt-i18n
Version:
A lightweight, modular JavaScript/TypeScript date and time utility with built-in internationalization (i18n) support for many languages.
26 lines (25 loc) • 1.06 kB
TypeScript
import { LocaleData, TimeUnit } from '../types/index';
import { Duration } from './Duration';
export declare class DateUtils {
private date;
private currentLocale;
private timezone;
constructor(date?: Date | string | number, formatOrLocale?: string | LocaleData, locale?: LocaleData);
locale(localeObject: LocaleData): this;
tz(timezone: string): this;
add(value: number, unit: TimeUnit): this;
subtract(value: number, unit: TimeUnit): this;
startOf(unit: TimeUnit): this;
endOf(unit: TimeUnit): this;
isBefore(otherDate: Date | string | number | DateUtils): boolean;
isAfter(otherDate: Date | string | number | DateUtils): boolean;
isSameDay(otherDate: Date | string | number | DateUtils): boolean;
isSameMonth(otherDate: Date | string | number | DateUtils): boolean;
diff(otherDate: Date | string | number | DateUtils): Duration;
toDate(): Date;
dayOfYear(): number;
weekOfYear(): number;
quarter(): number;
calendar(): DateUtils[][];
format(formatString: string): string;
}