mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
Bug 1364026 - (Part 2) Check if min and max attributes on input type date are valid date strings
This commit is contained in:
parent
549212cd38
commit
7f3ec297c9
3 changed files with 13 additions and 10 deletions
|
|
@ -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(),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue