Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/type dateadapter override #8377

Merged
merged 4 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions types/adapters.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
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;
etimberg marked this conversation as resolved.
Show resolved Hide resolved
readonly options: any;

/**
* Returns a map of time formats for the supported formatting units defined
* in Unit as well as 'datetime' representing a detailed date/time string.
Expand Down Expand Up @@ -54,16 +58,6 @@ export interface DateAdapterBase {
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: {
_date: DateAdapter;
};
2 changes: 1 addition & 1 deletion types/index.esm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
ScriptableAndArrayOptions
} from './scriptable';

export { DateAdapterBase, DateAdapter, TimeUnit, _adapters } from './adapters';
export { DateAdapter, TimeUnit, _adapters } from './adapters';
export { Animation, Animations, Animator, AnimationEvent } from './animation';
export { Color } from './color';
export { Element } from './element';
Expand Down