-
Notifications
You must be signed in to change notification settings - Fork 161
DatePickerUtil refactoring #9135
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
Conversation
- rename to DateTimeUtil
projects/igniteui-angular/src/lib/date-common/util/date-time.util.spec.ts
Outdated
Show resolved
Hide resolved
@@ -652,7 +652,7 @@ export class IgxDateRangePickerComponent extends PickersBaseDirective | |||
/** @hidden @internal */ | |||
public ngOnChanges(changes: SimpleChanges): void { | |||
if (changes['locale']) { | |||
this.inputFormat = DatePickerUtil.getDefaultInputFormat(this.locale || 'en') || DatePickerUtil.DEFAULT_INPUT_FORMAT; | |||
this.inputFormat = DateTimeUtil.getDefaultInputFormat(this.locale) || DateTimeUtil.DEFAULT_INPUT_FORMAT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like getDefaultInputFormat would return a falsy value in any case, so not sure about the fallback to the default input. Also the util falls back to a different default format for some reason?
Also also (!) - setting the input format public prop like this can be destructive if it's already specified by the user.
@@ -359,15 +357,15 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh | |||
return { value: true }; | |||
} | |||
|
|||
const maxValueAsDate = this.isDate(this.maxValue) ? this.maxValue : this.parseDate(this.maxValue); | |||
const minValueAsDate = this.isDate(this.minValue) ? this.minValue : this.parseDate(this.minValue); | |||
const maxValueAsDate = isDate(this.maxValue) ? this.maxValue : this.parseDate(this.maxValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this hasn't changed, but there's an edge case w/ invalid date that'd fail here, since both options aren't equipped to handle it.
Related to #8939, #8947
Additional information (check all that apply):
Checklist:
feature/README.MD
updates for the feature docsREADME.MD
CHANGELOG.MD
updates for newly added functionalityng update
migrations for the breaking changes (migrations guidelines)