input box this.mMonthPlaceHolder = "mm"; this.mDayPlaceHolder = "dd"; this.mYearPlaceHolder = "yyyy"; this.mSeparatorText = "/"; this.mMinMonth = 1; this.mMaxMonth = 12; this.mMinDay = 1; this.mMaxDay = 31; this.mMinYear = 1; // Maximum year limited by ECMAScript date object range, year <= 275760. this.mMaxYear = 275760; this.mMonthDayLength = 2; this.mYearLength = 4; this.mMonthPageUpDownInterval = 3; this.mDayPageUpDownInterval = 7; this.mYearPageUpDownInterval = 10; // Default to en-US, month-day-year order. this.mMonthField = document.getAnonymousElementByAttribute(this, "anonid", "input-one"); this.mDayField = document.getAnonymousElementByAttribute(this, "anonid", "input-two"); this.mYearField = document.getAnonymousElementByAttribute(this, "anonid", "input-three"); this.mYearField.size = this.mYearLength; this.mYearField.maxLength = this.mMaxYear.toString().length; this.mMonthField.placeholder = this.mMonthPlaceHolder; this.mDayField.placeholder = this.mDayPlaceHolder; this.mYearField.placeholder = this.mYearPlaceHolder; this.mMonthField.setAttribute("min", this.mMinMonth); this.mMonthField.setAttribute("max", this.mMaxMonth); this.mMonthField.setAttribute("pginterval", this.mMonthPageUpDownInterval); this.mDayField.setAttribute("min", this.mMinDay); this.mDayField.setAttribute("max", this.mMaxDay); this.mDayField.setAttribute("pginterval", this.mDayPageUpDownInterval); this.mYearField.setAttribute("min", this.mMinYear); this.mYearField.setAttribute("max", this.mMaxYear); this.mYearField.setAttribute("pginterval", this.mYearPageUpDownInterval); this.mDaySeparator = document.getAnonymousElementByAttribute(this, "anonid", "sep-first"); this.mDaySeparator.textContent = this.mSeparatorText; this.mYearSeparator = document.getAnonymousElementByAttribute(this, "anonid", "sep-second"); this.mYearSeparator.textContent = this.mSeparatorText; if (this.mInputElement.value) { this.setFieldsFromInputValue(); } ]]> max) { return true; } return false; ]]> this.getDaysInMonth(month, year)) { // Don't set invalid date, otherwise input element's value will be // set to empty. return; } let date = [year, month, day].join("-"); this.log("setInputValueFromFields: " + date); this.mInputElement.setUserInput(date); ]]> = targetField.maxLength || n * 10 > max) { buffer = ""; this.advanceToNextField(); } targetField.setAttribute("typeBuffer", buffer); } ]]> max) { value -= (max - min + 1); } else if (value < min) { value += (max - min + 1); } this.setFieldValue(aTargetField, value); aTargetField.select(); ]]> max) { value = max; } } if (aField == this.mMonthField || aField == this.mDayField) { // prepend zero if (value < 10) { value = "0" + value; } } else { // prepend zeroes if (value < 10) { value = "000" + value; } else if (value < 100) { value = "00" + value; } else if (value < 1000) { value = "0" + value; } if (value.toString().length > this.mYearLength && value.toString().length <= this.mMaxYear.toString().length) { this.mYearField.size = value.toString().length; } } aField.value = value; ]]> = this.mMaxHourInHour12) ? this.mPMIndicator : this.mAMIndicator; } if (!this.isEmpty(second)) { let index = second.indexOf("."); let millisecond; if (index != -1) { millisecond = second.substring(index + 1); second = second.substring(0, index); } if (!this.mSecondField) { this.mSecondSeparator = this.insertSeparator(this.mSeparatorText); this.mSecondField = this.insertAdditionalField(this.mPlaceHolder, this.mMinSecond, this.mMaxSecond, this.mMaxLength, this.mMaxLength); } this.setFieldValue(this.mSecondField, second); if (!this.isEmpty(millisecond)) { if (!this.mMillisecField) { this.mMillisecSeparator = this.insertSeparator( this.mMillisecSeparatorText); this.mMillisecField = this.insertAdditionalField( this.mPlaceHolder, this.mMinMillisecond, this.mMaxMillisecond, this.mMillisecMaxLength, this.mMillisecMaxLength); } this.setFieldValue(this.mMillisecField, millisecond); } else if (this.mMillisecField) { this.mMillisecField.remove(); this.mMillisecField = null; this.mMillisecSeparator.remove(); this.mMillisecSeparator = null; } } else { if (this.mSecondField) { this.mSecondField.remove(); this.mSecondField = null; this.mSecondSeparator.remove(); this.mSecondSeparator = null; } if (this.mMillisecField) { this.mMillisecField.remove(); this.mMillisecField = null; this.mMillisecSeparator.remove(); this.mMillisecSeparator = null; } } this.notifyPicker(); ]]> = this.mMaxHourInHour12) ? this.mPMIndicator : this.mAMIndicator; } } if (!this.isEmpty(minute)) { this.setFieldValue(this.mMinuteField, minute); } ]]> max) { value -= (max - min + 1); } else if (value < min) { value += (max - min + 1); } this.setFieldValue(aTargetField, value); aTargetField.select(); ]]> = targetField.maxLength || n * 10 > max) { buffer = ""; this.advanceToNextField(); } targetField.setAttribute("typeBuffer", buffer); } ]]> this.mMaxHourInHour12) ? value - this.mMaxHourInHour12 : value; if (aValue == "00") { value = this.mMaxHourInHour12; } } // prepend zero if (value < 10) { value = "0" + value; } } else if (aField.maxLength == this.mMillisecMaxLength) { // prepend zeroes if (value < 10) { value = "00" + value; } else if (value < 100) { value = "0" + value; } } aField.value = value; ]]> { this.addEventListener(eventName, this, { mozSystemGroup: true }); }); // Handle keypress separately since we need to catch it on capturing. this.addEventListener("keypress", this, { capture: true, mozSystemGroup: true }); ]]> { this.removeEventListener(eventName, this, { mozSystemGroup: true }); }); this.removeEventListener("keypress", onKeyPress, { capture: true, mozSystemGroup: true }); ]]> return (aValue == undefined || 0 === aValue.length); throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED;