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 28, 2020
1 parent 4afba57 commit f1ec0c6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,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 f1ec0c6

Please sign in to comment.