@devexperts/dxcharts-lite
Version:
52 lines (51 loc) • 2.56 kB
TypeScript
/*
* Copyright (C) 2019 - 2025 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 { Observable } from 'rxjs';
import { DateFormatter, FullChartConfig } from '../chart.config';
import { DateTimeFormatter, DateTimeFormatterFactory } from './date-time.formatter';
import { Timestamp } from './scaling/viewport.model';
export interface TimeZone {
readonly timeZone: string;
readonly name: string;
readonly utcOffset: string;
}
export declare class TimeZoneModel {
private config;
private timeZoneChangedSubject;
private dateTimeFormatterFactory;
currentTzOffset: (time: Timestamp) => number;
constructor(config: FullChartConfig);
/**
* Sets the timezone for the configuration and updates the current timezone offset.
* @param {string} timeZone - The timezone to set.
* @returns {void}
*/
setTimeZone(timeZone: string): void;
/**
* Returns an Observable that emits a string value when the time zone is changed.
* The Observable is created from the timeZoneChangedSubject Subject.
* @returns {Observable<string>} An Observable that emits a string value when the time zone is changed.
*/
observeTimeZoneChanged(): Observable<string>;
/**
* Initializes a DateTimeFormatterFactory object.
* @param {DateFormatter} [dateFormatter] - Optional DateFormatter object.
* @returns {DateTimeFormatterFactory} - Returns a DateTimeFormatterFactory object.
* If a plain function is provided as the dateFormatter parameter, it will be used as a date formatter without applying UTC datetime override for candles more than 1d period.
* If a custom date formatter exists, it will be used for datetime formatting applying optionally UTC datetime override for candles more than 1d period.
* If no dateFormatter is provided, a default DateTimeFormatterFactory object will be returned.
*/
initFormatterFactory(dateFormatter?: DateFormatter): DateTimeFormatterFactory;
/**
* Returns the DateTimeFormatterFactory instance used by this class.
*
* @returns {DateTimeFormatterFactory} The DateTimeFormatterFactory instance used by this class.
*/
getFormatterFactory(): DateTimeFormatterFactory;
private formatterCache;
getDateTimeFormatter(format: string): DateTimeFormatter;
tzOffset(timezone: string): (time: number) => Date;
}