diff options
Diffstat (limited to 'toolkit/content')
-rw-r--r-- | toolkit/content/browser-content.js | 4 | ||||
-rw-r--r-- | toolkit/content/widgets/datekeeper.js | 15 | ||||
-rw-r--r-- | toolkit/content/widgets/datepicker.js | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js index b955bd29d..145de9608 100644 --- a/toolkit/content/browser-content.js +++ b/toolkit/content/browser-content.js @@ -1728,8 +1728,8 @@ let DateTimePickerListener = { // element's value. value: Object.keys(value).length > 0 ? value : this._inputElement.value, - min: this._inputElement.min, - max: this._inputElement.max, + min: this._inputElement.getMinimum(), + max: this._inputElement.getMaximum(), step: this._inputElement.getStep(), stepBase: this._inputElement.getStepBase(), }, diff --git a/toolkit/content/widgets/datekeeper.js b/toolkit/content/widgets/datekeeper.js index 9517e2154..4959b9609 100644 --- a/toolkit/content/widgets/datekeeper.js +++ b/toolkit/content/widgets/datekeeper.js @@ -16,9 +16,11 @@ function DateKeeper(props) { MONTHS_IN_A_YEAR = 12, YEAR_VIEW_SIZE = 200, YEAR_BUFFER_SIZE = 10, - // The min and max values are derived from the ECMAScript spec: + // The min value is 0001-01-01 based on HTML spec: + // https://html.spec.whatwg.org/#valid-date-string + MIN_DATE = -62135596800000, + // The max value is derived from the ECMAScript spec: // http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.1 - MIN_DATE = -8640000000000000, MAX_DATE = 8640000000000000; DateKeeper.prototype = { @@ -43,8 +45,8 @@ function DateKeeper(props) { * @param {Number} year * @param {Number} month * @param {Number} day - * @param {String} min - * @param {String} max + * @param {Number} min + * @param {Number} max * @param {Number} step * @param {Number} stepBase * @param {Number} firstDayOfWeek @@ -57,8 +59,9 @@ function DateKeeper(props) { this.state = { step, firstDayOfWeek, weekends, calViewSize, - min: new Date(min != undefined ? min : MIN_DATE), - max: new Date(max != undefined ? max : MAX_DATE), + // min & max are NaN if empty or invalid + min: new Date(Number.isNaN(min) ? MIN_DATE : min), + max: new Date(Number.isNaN(max) ? MAX_DATE : max), stepBase: new Date(stepBase), today: this._newUTCDate(today.getFullYear(), today.getMonth(), today.getDate()), weekHeaders: this._getWeekHeaders(firstDayOfWeek, weekends), diff --git a/toolkit/content/widgets/datepicker.js b/toolkit/content/widgets/datepicker.js index 25b15dae6..0c288d917 100644 --- a/toolkit/content/widgets/datepicker.js +++ b/toolkit/content/widgets/datepicker.js @@ -20,8 +20,8 @@ function DatePicker(context) { * {Number} year [optional] * {Number} month [optional] * {Number} date [optional] - * {String} min - * {String} max + * {Number} min + * {Number} max * {Number} step * {Number} stepBase * {Number} firstDayOfWeek |