import type { ILocaleSettings } from "./Language"; import { Entity, IEntitySettings, IEntityPrivate } from "./Entity"; /** * Interface describing parsed date format definition. * * @ignore */ export interface DateFormatInfo { "template": string; "parts": any[]; } export interface IDateFormatterSettings extends IEntitySettings { /** * Capitalizes the first letter of the formatted date. * * @default true */ capitalize?: boolean; /** * Format used when no other format is given: a format string, or options * for `Intl.DateTimeFormat`. * * @default "yyyy-MM-dd" * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-dates/} for more info */ dateFormat?: string | Intl.DateTimeFormatOptions; /** * Data fields that hold dates. Text placeholders with these fields, such as * `{date}`, are formatted as dates even without `formatDate()`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/data-placeholders/#Formatting_placeholders} for more info */ dateFields?: string[]; /** * Locale for formats given as `Intl.DateTimeFormat` options, such as * `"de-DE"`. The browser's locale if not set. */ intlLocales?: string; } export interface IDateFormatterPrivate extends IEntityPrivate { } declare type Months = "January" | "February" | "March" | "April" | "May" | "June" | "July" | "August" | "September" | "October" | "November" | "December"; declare type ShortMonths = "Jan" | "Feb" | "Mar" | "Apr" | "May(short)" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"; declare type Weekdays = "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday"; declare type ShortWeekdays = "Sun" | "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat"; /** * Formats dates in labels, tooltips and other text, and parses date strings. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-dates/} for more info * @important */ export declare class DateFormatter extends Entity { _settings: IDateFormatterSettings; _privateSettings: IDateFormatterPrivate; static className: string; static classNames: Array; protected _setDefaults(): void; _beforeChanged(): void; /** * Formats a `Date` as a string. * @param source Date * @param format Format string or `Intl.DateTimeFormat` options; `dateFormat` if not given * @param ignoreTimezone Ignore the root's `utc` and `timezone` settings * @return Formatted date */ format(source: any, format?: string | Intl.DateTimeFormatOptions, ignoreTimezone?: boolean): string; /** * Applies format to Date. * * @param date Date object * @param info Parsed format information * @return Formatted date string */ protected applyFormat(date: Date, info: DateFormatInfo, ignoreTimezone?: boolean, originalDate?: Date, utc?: boolean): string; /** * Parses a format into structured information. * * @param format Format template */ protected parseFormat(format: string): DateFormatInfo; protected _months(): Months[]; protected _getMonth(index: number): Months; protected _shortMonths(): ShortMonths[]; protected _getShortMonth(index: number): ShortMonths; protected _weekdays(): Weekdays[]; protected _getWeekday(index: number): Weekdays; protected _shortWeekdays(): ShortWeekdays[]; protected _getShortWeekday(index: number): ShortWeekdays; /** * Parses a date string in `format` into a `Date`. A `Date` is returned as * it is and a number is read as a timestamp. A string that doesn't match * the format is passed to the `Date` constructor. * * @param source Date string * @param format Format of the string, such as `"yyyy-MM-dd"` * @param utc Parse as UTC; the root's `utc` setting if not given * @return Date */ parse(source: any, format: string, utc?: boolean): Date; protected resolveTimezoneOffset(date: Date, zone: string): number; /** * Resolves a month name (e.g. "December") into a month number (11). * * @param value Month name * @return Month number */ protected resolveMonth(value: Months): number; /** * Resolves a short month name (e.g. "Dec") into a month number. * * @param value Short month name * @return Month number */ protected resolveShortMonth(value: ShortMonths): number; /** * Checks if a string is an AM marker ("AM", "A.M." or "A", or their * translations). * * @param value Source string * @return Is it AM? */ protected isAm(value: string): boolean; /** * Translates list of strings. * * @param list Source strings * @return Translated strings */ protected getStringList(list: Array): Array; } export {}; //# sourceMappingURL=DateFormatter.d.ts.map