-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type fixes for time adapters (#12010)
Specific changes: * `formats` is defined as an arbitrary record. In practice, it maps from `TimeUnit` and `'datetime'` to the specific date library's format strings. * `parse` and `format` were defined as requiring `TimeUnit`, but they actually take date library format strings. (E.g., it's up to the caller to look up format strings via `formats()` or user parameters.) * `endOf` is never passed `isoWeek` (`isoWeek` isn't a normal `TimeUnit`, it's only used as a special case to `startOf`), and [chartjs-adapter-date-fns](https://github.com/chartjs/chartjs-adapter-date-fns/blob/v3.0.0/src/index.js#L101) doesn't support it. * The constructor's options parameter is optional. * `weekday` is documented as allowing a boolean (true means to start on Monday). * `export default { _date: DateAdapterBase }` meant that `new _date()` returns a `DateAdapterBase` instance, whose methods take no parameters. Since it can be overridden at runtime, I replaced it with a more generic constructor + static methods.
- Loading branch information
Showing
2 changed files
with
14 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters