UNPKG

napicuformatter

Version:
173 lines (172 loc) 4 kB
import { INapicuFormat } from './interface/Date'; import { INapicuConfigDate } from './interface/config'; export declare class NapicuDate { protected _date: Date; protected _formats: INapicuFormat; constructor(); constructor(timestamp: number); constructor(year: number, month: number); constructor(yearOrTimestamp: number, month: number, day?: number, hours?: number, minutes?: number, seconds?: number, ms?: number); /** * Format the date * * %yyyy - Year * * %MM - Month * * %MMN - Month name * * %MN - Month name short * * %dd - Day * * %dt - Date * * %ddn - Day name * * %dn - Day name short * * %DMAX - Max days in current month * * %HH - 24 Hour * * %hh - 12 Hour * * %mm - Minutes * * %ss - Seconds * * %a - AM/PM * * %z - Timezone * @param format */ format(format: string): string; /** * Sets the config language * @param config */ static use(config: INapicuConfigDate): void; /** * Gets the day * @param date */ protected getDay(date: Date): string; /** * Gets the date * @param date */ protected getDate(date: Date): string; /** * Gets the month * @param date */ protected getMonth(date: Date): string; /** * Gets the month name * @param date */ protected getMonthName(date: Date): string; /** * Gets the month name short */ protected getShortMonthName(date: Date): string; /** * Gets the day name * @param date */ protected getDayName(date: Date): string; /** * Gets the day name short * @param date */ protected getShortDayName(date: Date): string; /** * Gets the year * @param date */ protected getYear(date: Date): string; /** * Gets maximum days in month */ protected getMaxDaysInMonth(date: Date): number; /** * Gets the hours in 24-hour format * @param date */ protected getHours24(date: Date): string; /** * Gets the hours in 12-hour format * @param date */ protected getHours12(date: Date): string; /** * Gets the minutes * @param date */ protected getMinutes(date: Date): string; /** * Gets the seconds * @param date */ protected getSeconds(date: Date): string; /** * Gets the meridian * @param date */ protected getMeridian(date: Date): "PM" | "AM"; /** * Gets the timezone * @param date */ protected getTimezone(date: Date): string; /** * Gets the days */ static getLanguageDays(): string[]; /** * Gets the months */ static getLanguageMonths(): string[]; /** * Gets the short days */ static getLanguageShortsDays(): string[]; /** * Gets the short months */ static getLanguageShortsMonths(): string[]; /** * Gets the day of the week, using local time */ getCurrentDay(): number; /** * Gets the day-of-the-month, using local time */ getCurrentDate(): number; /** * Gets the current month */ getCurrentMonth(): number; /** * Gets the current year */ getCurrentYear(): number; /** * Gets the current seconds */ getCurrentSeconds(): number; /** * Gets the current minutes */ getCurrentMinutes(): number; /** * Gets the current minutes */ getCurrentHours(): number; /** * Gets the current meridian */ getCurrentMeridian(): "PM" | "AM"; /** * Gets the current day name */ getCurrentDayName(): string; /** * Gets the current month name */ getCurrentMonthName(): string; /** * Gets the time value in milliseconds. */ getTimeStamp(): number; /** * Gets maximum days in current month */ getMaxDaysInCurrentMonth(): number; }