@devexperts/dxcharts-lite
Version:
41 lines (40 loc) • 2.19 kB
TypeScript
/*
* Copyright (C) 2019 - 2026 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { FullChartConfig, DateTimeFormatConfig } from '../chart.config';
export interface TimeFormatterConfig {
shortDays?: string[];
shortMonths?: string[];
}
export interface DateTimeFormatter {
(date: number): string;
}
export type DateTimeFormatterFactory = (format: string) => DateTimeFormatter;
export declare const defaultDateTimeFormatter: () => (date: number) => string;
/**
* Default chart-core time formatter.
* @param config
* @param offsetFunction
* @doc-tags chart-core,default-config,date-formatter
*/
export declare const dateTimeFormatterFactory: (config: FullChartConfig, offsetFunction: (timezone: string) => (time: number) => Date) => DateTimeFormatterFactory;
/**
* Returns an array of short day names based on the provided configuration object.
* If the configuration object does not contain shortDays property, it returns an array of default short day names.
*
* @param {TimeFormatterConfig} config - The configuration object containing shortDays property.
* @returns {string[]} - An array of short day names.
*/
export declare function getShortDays(config: TimeFormatterConfig): string[];
/**
* Returns an array of short month names based on the provided configuration object.
* If the configuration object does not have a 'shortMonths' property, it returns the default array of short month names.
*
* @param {TimeFormatterConfig} config - The configuration object that contains the shortMonths property.
* @returns {string[]} - An array of short month names.
*/
export declare function getShortMonths(config: TimeFormatterConfig): string[];
export declare const recalculateXFormatter: (xAxisLabelFormat: string | Array<DateTimeFormatConfig>, period: number, formatterFactory: (format: string) => (timestamp: number) => string) => DateTimeFormatter;
export declare const formatDate: (date: Date, patternStr: string, daysOfWeek: string[], months: string[]) => string;