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

DatePickerUtil refactoring #9135

Merged
merged 5 commits into from
Mar 19, 2021

Conversation

jackofdiamond5
Copy link
Member

@jackofdiamond5 jackofdiamond5 commented Mar 12, 2021

Related to #8939, #8947

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@@ -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;
Copy link
Member

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);
Copy link
Member

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.

@damyanpetev damyanpetev added squash-merge Merge PR with "Squash and Merge" option and removed ❌ status: awaiting-test PRs awaiting manual verification labels Mar 19, 2021
@damyanpetev damyanpetev merged commit f99d888 into pickers-refactoring Mar 19, 2021
@damyanpetev damyanpetev deleted the bpenkov/dp-util-refactoring branch March 19, 2021 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants