Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): add injection token for default DatePipe configuration (#…
…47157) This commit introduces a new `DATE_PIPE_DEFAULT_OPTIONS` token, which can be used to configure default DatePipe options, such as date format and timezone. DEPRECATED: The `DATE_PIPE_DEFAULT_TIMEZONE` token is now deprecated in favor of the `DATE_PIPE_DEFAULT_OPTIONS` token, which accepts an object as a value and the timezone can be defined as a field (called `timezone`) on that object. PR Close #47157
- Loading branch information
1 parent
a792bf1
commit bdb5371
Showing
8 changed files
with
192 additions
and
14 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
/** | ||
* An interface that describes the date pipe configuration, which can be provided using the | ||
* `DATE_PIPE_DEFAULT_OPTIONS` token. | ||
* | ||
* @see `DATE_PIPE_DEFAULT_OPTIONS` | ||
* | ||
* @publicApi | ||
*/ | ||
export interface DatePipeConfig { | ||
dateFormat: string; | ||
timezone: string; | ||
} | ||
|
||
/** | ||
* The default date format of Angular date pipe, which corresponds to the following format: | ||
* `'MMM d,y'` (e.g. `Jun 15, 2015`) | ||
*/ | ||
export const DEFAULT_DATE_FORMAT = 'mediumDate'; |
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