1414
1515import type Nullable from './common/Nullable'
1616import type DeepPartial from './common/DeepPartial'
17+ import type PickRequired from './common/PickRequired'
1718import type { KLineData , VisibleRangeData } from './common/Data'
1819import type VisibleRange from './common/VisibleRange'
1920import type Coordinate from './common/Coordinate'
@@ -24,7 +25,7 @@ import type BarSpace from './common/BarSpace'
2425import type Precision from './common/Precision'
2526import Action from './common/Action'
2627import { ActionType , type ActionCallback } from './common/Action'
27- import { formatValue , formatTimestampToString , formatBigNumber , formatThousands , formatFoldDecimal } from './common/utils/format'
28+ import { formatValue , formatTimestampByTemplate , formatBigNumber , formatThousands , formatFoldDecimal } from './common/utils/format'
2829import { getDefaultStyles , type TooltipFeatureStyle , type Styles , type TooltipLegend } from './common/Styles'
2930import { isArray , isString , isValid , isNumber , isBoolean , isFunction , merge } from './common/utils/typeChecks'
3031import { createId } from './common/utils/id'
@@ -36,7 +37,7 @@ import { type LoadDataCallback, type LoadDataParams, LoadDataType } from './comm
3637import type TimeWeightTick from './common/TimeWeightTick'
3738import { classifyTimeWeightTicks , createTimeWeightTickList } from './common/TimeWeightTick'
3839
39- import type { Options , CustomApi , ThousandsSeparator , DecimalFold } from './Options'
40+ import type { Options , CustomApi , ThousandsSeparator , DecimalFold , FormatDateType , FormatDateParams , FormatBigNumber } from './Options'
4041
4142import { IndicatorDataState , type IndicatorOverride , type IndicatorCreate , type IndicatorFilter , type Indicator } from './component/Indicator'
4243import type IndicatorImp from './component/Indicator'
@@ -52,7 +53,6 @@ import { getStyles as getExtensionStyles } from './extension/styles/index'
5253import { PaneIdConstants } from './pane/types'
5354
5455import type Chart from './Chart'
55- import type PickRequired from './common/PickRequired'
5656
5757const BarSpaceLimitConstants = {
5858 MIN : 1 ,
@@ -150,10 +150,23 @@ export default class StoreImp implements Store {
150150 * Custom api
151151 */
152152 private readonly _customApi = {
153- formatDate : ( timestamp : number , format : string ) => formatTimestampToString ( this . _dateTimeFormat , timestamp , format ) ,
153+ formatDate : ( {
154+ dateTimeFormat,
155+ timestamp,
156+ template
157+ } : FormatDateParams ) => formatTimestampByTemplate ( dateTimeFormat , timestamp , template ) ,
154158 formatBigNumber
155159 }
156160
161+ /**
162+ * Inner custom api
163+ * @description Internal use only
164+ */
165+ private readonly _innerCustomApi = {
166+ formatDate : ( timestamp : number , template : string , type : FormatDateType ) => this . _customApi . formatDate ( { dateTimeFormat : this . _dateTimeFormat , timestamp, template, type } ) ,
167+ formatBigNumber : this . _customApi . formatBigNumber
168+ }
169+
157170 /**
158171 * Locale
159172 */
@@ -397,6 +410,13 @@ export default class StoreImp implements Store {
397410
398411 getCustomApi ( ) : CustomApi { return this . _customApi }
399412
413+ getInnerCustomApi ( ) : {
414+ formatDate : ( timestamp : number , template : string , type : FormatDateType ) => string
415+ formatBigNumber : FormatBigNumber
416+ } {
417+ return this . _innerCustomApi
418+ }
419+
400420 setLocale ( locale : string ) : void { this . _locale = locale }
401421
402422 getLocale ( ) : string { return this . _locale }
0 commit comments