UNPKG

cerceis-lib

Version:

Contains list of quality of life functions that is written in TypeScript and es6

49 lines (47 loc) 1.57 kB
interface FormatOptions { time?: boolean; asObject?: boolean; } interface ObjectifiedDate { Y: number; M: number; D: number; h?: number; m?: number; s?: number; } declare const isDateObject: (d: unknown) => d is Date; declare const FromTime: { jpnDayMap: Record<number, string>; toMs: (h?: number, m?: number, s?: number, ms?: number) => number; toSeconds: (h?: number, m?: number, s?: number, ms?: number) => number; toMinutes: (h?: number, m?: number, s?: number, ms?: number) => number; toHours: (h?: number, m?: number, s?: number, ms?: number) => number; /** * Format a Date into "YYYY-MM-DD HH:mm:ss" (UTC). * @param date Date object * @param options time: include time portion; asObject: return ObjectifiedDate */ format(date: Date, options?: FormatOptions): string | ObjectifiedDate; /** * Convert a date string to the shortest readable locale string. * Year > Month > Day > Same day > time only. * Currently supports "jpn" only. * @param input Date string * @param locale Language code (default "jpn") */ toDateTimeShortLocale(input: string, locale?: string): string; }; declare class cDate { private _date; constructor(date: string | Date); /** * Add N months to the stored date. * @param n Number of months to add */ addMonth(n: number): void; get dateTime(): string; get date(): string; get time(): string; } export { type FormatOptions, FromTime, type ObjectifiedDate, cDate, isDateObject };