diff --git a/package.json b/package.json index 60bb6ff4659..a5af0338aa4 100644 --- a/package.json +++ b/package.json @@ -133,4 +133,4 @@ "node": ">=10", "npm": ">=6" } -} \ No newline at end of file +} diff --git a/src/components/datepicker/js/dateUtil.js b/src/components/datepicker/js/dateUtil.js index ef42a0f3fb5..b848d1e0e2a 100644 --- a/src/components/datepicker/js/dateUtil.js +++ b/src/components/datepicker/js/dateUtil.js @@ -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; diff --git a/src/components/datepicker/js/datepickerDirective.js b/src/components/datepicker/js/datepickerDirective.js index 99efc62406f..48dedf72d06 100644 --- a/src/components/datepicker/js/datepickerDirective.js +++ b/src/components/datepicker/js/datepickerDirective.js @@ -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;