UNPKG

universal-common

Version:

Library that provides useful missing base class library functionality.

315 lines (314 loc) 10.2 kB
/** * Provides culture-specific information about date and time formatting. * This class supplies the patterns, names, and other formatting data used by DateTime formatting. */ export default class DateTimeFormatInfo { static "__#3@#invariantInfo": any; static "__#3@#cultureCache": Map<any, any>; /** * Returns a read-only DateTimeFormatInfo wrapper. * * @param {DateTimeFormatInfo} dtfi - The DateTimeFormatInfo to make read-only * @returns {DateTimeFormatInfo} A read-only wrapper */ static readOnly(dtfi: DateTimeFormatInfo): DateTimeFormatInfo; /** * Gets a read-only DateTimeFormatInfo that formats values based on the invariant culture. * * @type {DateTimeFormatInfo} * @readonly * @static */ static readonly get invariantInfo(): DateTimeFormatInfo; /** * Gets a read-only DateTimeFormatInfo that formats values based on the current culture. * * @type {DateTimeFormatInfo} * @readonly * @static */ static readonly get currentInfo(): DateTimeFormatInfo; /** * Returns a DateTimeFormatInfo associated with the specified locale. * * @param {string} [locale] - The locale identifier, or null for current culture * @returns {DateTimeFormatInfo} A DateTimeFormatInfo associated with the locale */ static getInstance(locale?: string): DateTimeFormatInfo; /** * Validates a custom format string for DateOnly. * * @param {string} format - Format string to validate * @param {boolean} throwOnError - Whether to throw on invalid format * @returns {boolean} Whether the format is valid for DateOnly */ static isValidCustomDateOnlyFormat(format: string, throwOnError?: boolean): boolean; /** * Validates a custom format string for TimeOnly. * * @param {string} format - Format string to validate * @param {boolean} throwOnError - Whether to throw on invalid format * @returns {boolean} Whether the format is valid for TimeOnly */ static isValidCustomTimeOnlyFormat(format: string, throwOnError?: boolean): boolean; /** * Creates a new DateTimeFormatInfo instance. * * @param {string} [locale='en-US'] - The locale identifier */ constructor(locale?: string); set dateSeparator(arg: string); /** * Gets or sets the string that separates the components of a date. * * @type {string} */ get dateSeparator(): string; set timeSeparator(arg: string); /** * Gets or sets the string that separates the components of time. * * @type {string} */ get timeSeparator(): string; set amDesignator(arg: string); /** * Gets or sets the string designator for hours that are "ante meridiem" (before noon). * * @type {string} */ get amDesignator(): string; set pmDesignator(arg: string); /** * Gets or sets the string designator for hours that are "post meridiem" (after noon). * * @type {string} */ get pmDesignator(): string; set shortDatePattern(arg: string); /** * Gets or sets the custom format string for a short date pattern. * * @type {string} */ get shortDatePattern(): string; set longDatePattern(arg: string); /** * Gets or sets the custom format string for a long date pattern. * * @type {string} */ get longDatePattern(): string; set shortTimePattern(arg: string); /** * Gets or sets the custom format string for a short time pattern. * * @type {string} */ get shortTimePattern(): string; set longTimePattern(arg: string); /** * Gets or sets the custom format string for a long time pattern. * * @type {string} */ get longTimePattern(): string; set fullDateTimePattern(arg: string); /** * Gets or sets the custom format string for a full date and time pattern. * * @type {string} */ get fullDateTimePattern(): string; set monthDayPattern(arg: string); /** * Gets or sets the custom format string for a month and day pattern. * * @type {string} */ get monthDayPattern(): string; set yearMonthPattern(arg: string); /** * Gets or sets the custom format string for a year and month pattern. * * @type {string} */ get yearMonthPattern(): string; /** * Gets the general short time pattern (short date + short time). * * @type {string} * @readonly */ readonly get generalShortTimePattern(): string; /** * Gets the general long time pattern (short date + long time). * * @type {string} * @readonly */ readonly get generalLongTimePattern(): string; /** * Gets the DateTimeOffset pattern (short date + long time + offset). * * @type {string} * @readonly */ readonly get dateTimeOffsetPattern(): string; /** * Gets the RFC1123 pattern. * * @type {string} * @readonly */ readonly get rfc1123Pattern(): string; /** * Gets the sortable date time pattern. * * @type {string} * @readonly */ readonly get sortableDateTimePattern(): string; /** * Gets the universal sortable date time pattern. * * @type {string} * @readonly */ readonly get universalSortableDateTimePattern(): string; set monthNames(arg: string[]); /** * Gets or sets a one-dimensional array of type String containing the culture-specific full names of the months. * * @type {string[]} */ get monthNames(): string[]; set abbreviatedMonthNames(arg: string[]); /** * Gets or sets a one-dimensional array of type String containing the culture-specific abbreviated names of the months. * * @type {string[]} */ get abbreviatedMonthNames(): string[]; set dayNames(arg: string[]); /** * Gets or sets a one-dimensional array of type String containing the culture-specific full names of the days of the week. * * @type {string[]} */ get dayNames(): string[]; set abbreviatedDayNames(arg: string[]); /** * Gets or sets a one-dimensional array of type String containing the culture-specific abbreviated names of the days of the week. * * @type {string[]} */ get abbreviatedDayNames(): string[]; /** * Gets whether genitive month names should be used. * * @type {boolean} * @readonly */ readonly get useGenitiveMonth(): boolean; /** * Gets a value indicating whether this DateTimeFormatInfo object is read-only. * * @type {boolean} * @readonly */ readonly get isReadOnly(): boolean; /** * Gets the full name of the specified month. * * @param {number} month - An integer from 1 to 12 representing the month * @param {string} [style='regular'] - The style ('regular', 'genitive', 'leap') * @param {boolean} [abbreviated=false] - Whether to return abbreviated name * @returns {string} The full name of the month */ getMonthName(month: number, style?: string, abbreviated?: boolean): string; /** * Gets the abbreviated name of the specified month. * * @param {number} month - An integer from 1 to 12 representing the month * @returns {string} The abbreviated name of the month */ getAbbreviatedMonthName(month: number): string; /** * Gets the full name of the specified day of the week. * * @param {number} dayOfWeek - An integer from 0 to 6 representing the day (Sunday = 0) * @returns {string} The full name of the day of the week */ getDayName(dayOfWeek: number): string; /** * Gets the abbreviated name of the specified day of the week. * * @param {number} dayOfWeek - An integer from 0 to 6 representing the day (Sunday = 0) * @returns {string} The abbreviated name of the day of the week */ getAbbreviatedDayName(dayOfWeek: number): string; /** * Gets the era name for the current calendar. * * @param {DateTime} dateTime - The DateTime to get era for * @returns {string} The era name */ getEraName(dateTime: DateTime): string; /** * Creates a shallow copy of the DateTimeFormatInfo. * * @returns {DateTimeFormatInfo} A shallow copy of the DateTimeFormatInfo */ clone(): DateTimeFormatInfo; /** * Gets all the standard patterns for the specified format character. * * @param {string} format - Standard format character * @returns {string[]} Array of patterns for the format */ getAllDateTimePatterns(format: string): string[]; /** * Sets all the date time patterns for a specific standard format character. * * @param {string[]} patterns - Array of patterns * @param {string} format - Standard format character */ setAllDateTimePatterns(patterns: string[], format: string): void; /** * Gets the native calendar name. * * @type {string} * @readonly */ readonly get nativeCalendarName(): string; set calendar(arg: any); /** * Gets or sets the calendar used for formatting. * * @type {Object} */ get calendar(): any; /** * Gets the first day of the week. * * @type {number} * @readonly */ readonly get firstDayOfWeek(): number; /** * Gets the rule used to determine the first week of the year. * * @type {number} * @readonly */ readonly get calendarWeekRule(): number; /** * Returns a string representation of the DateTimeFormatInfo. * * @returns {string} String representation */ toString(): string; #private; } import DateTime from "./DateTime.js";