mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Fix/type dateadapter override (#8377)
* Not totally sure this is right , but since in core.adapters.js override is part of the dateadapter it seems logical it should be there. Should also fix #8369 * implemented feedback * Declare the dataAdapter since it will be available at runtime if someone overrides it * remove declaration. if this is giving problems in the future it might need te be added again
This commit is contained in:
parent
505afa7f13
commit
22ca8af1cd
16
types/adapters.d.ts
vendored
16
types/adapters.d.ts
vendored
@ -1,6 +1,10 @@
|
|||||||
export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||||
|
|
||||||
export interface DateAdapterBase {
|
export interface DateAdapter {
|
||||||
|
// Override one or multiple of the methods to adjust to the logic of the current date library.
|
||||||
|
override(members: Partial<DateAdapter>): void;
|
||||||
|
readonly options: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of time formats for the supported formatting units defined
|
* Returns a map of time formats for the supported formatting units defined
|
||||||
* in Unit as well as 'datetime' representing a detailed date/time string.
|
* in Unit as well as 'datetime' representing a detailed date/time string.
|
||||||
@ -54,16 +58,6 @@ export interface DateAdapterBase {
|
|||||||
endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
|
endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DateAdapter extends DateAdapterBase {
|
|
||||||
readonly options: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DateAdapter: {
|
|
||||||
prototype: DateAdapter;
|
|
||||||
new(options: any): DateAdapter;
|
|
||||||
override(members: Partial<DateAdapter>): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const _adapters: {
|
export const _adapters: {
|
||||||
_date: DateAdapter;
|
_date: DateAdapter;
|
||||||
};
|
};
|
||||||
|
2
types/index.esm.d.ts
vendored
2
types/index.esm.d.ts
vendored
@ -24,7 +24,7 @@ import {
|
|||||||
ScriptableAndArrayOptions
|
ScriptableAndArrayOptions
|
||||||
} from './scriptable';
|
} from './scriptable';
|
||||||
|
|
||||||
export { DateAdapterBase, DateAdapter, TimeUnit, _adapters } from './adapters';
|
export { DateAdapter, TimeUnit, _adapters } from './adapters';
|
||||||
export { Animation, Animations, Animator, AnimationEvent } from './animation';
|
export { Animation, Animations, Animator, AnimationEvent } from './animation';
|
||||||
export { Color } from './color';
|
export { Color } from './color';
|
||||||
export { Element } from './element';
|
export { Element } from './element';
|
||||||
|
Loading…
Reference in New Issue
Block a user