Skip to content

Commit b5c935a

Browse files
kaisnbmmalerba
andauthored
fix: making the parse format available for native date adapter extension (#25226)
* fix: making the parse format available for adapter extension If we want to extend the native date adapter and extend the parse implementation to support multiple locales and formats, it is not possible since the parse signature does not contain the parseFormat as in its superclass DateAdapter. * fixup! fix: making the parse format available for adapter extension Co-authored-by: Miles Malerba <mmalerba@google.com>
1 parent 13bbe9d commit b5c935a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/material/core/datetime/native-date-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class NativeDateAdapter extends DateAdapter<Date> {
125125
return new Date();
126126
}
127127

128-
parse(value: any): Date | null {
128+
parse(value: any, parseFormat?: any): Date | null {
129129
// We have no way using the native JS Date to set the parse format or locale, so we ignore these
130130
// parameters.
131131
if (typeof value == 'number') {

tools/public_api_guard/material/core.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export class NativeDateAdapter extends DateAdapter<Date> {
464464
// (undocumented)
465465
isValid(date: Date): boolean;
466466
// (undocumented)
467-
parse(value: any): Date | null;
467+
parse(value: any, parseFormat?: any): Date | null;
468468
// (undocumented)
469469
today(): Date;
470470
// (undocumented)

0 commit comments

Comments
 (0)