Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(datepicker): min-date validation is incorrect in GMT+X timezones
Browse files Browse the repository at this point in the history
Fixes #11963
  • Loading branch information
Splaktar committed Aug 31, 2020
1 parent b32b473 commit dd150fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@
"node": ">=10",
"npm": ">=6"
}
}
}
4 changes: 2 additions & 2 deletions src/components/datepicker/js/dateUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@
}

/**
* @param {Date} value
* @return {boolean|boolean}
* @param {Date} value date in local timezone
* @return {Date} date with local timezone removed
*/
function removeLocalTzAndReparseDate(value) {
var dateValue, formattedDate;
Expand Down
2 changes: 1 addition & 1 deletion src/components/datepicker/js/datepickerDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@
var self = this;
var timezone = this.$mdUtil.getModelOption(this.ngModelCtrl, 'timezone');

if (this.dateUtil.isValidDate(value)) {
if (this.dateUtil.isValidDate(value) && timezone != null) {
this.date = this.dateUtil.removeLocalTzAndReparseDate(value);
} else {
this.date = value;
Expand Down

0 comments on commit dd150fa

Please sign in to comment.