%datetimeboxDTD; ]> "&date.year.placeholder;""&date.month.placeholder;""&date.day.placeholder;" { switch (part.type) { case "year": fragment.appendChild(this.mYearField); break; case "month": fragment.appendChild(this.mMonthField); break; case "day": fragment.appendChild(this.mDayField); break; default: let span = document.createElementNS(HTML_NS, "span"); span.textContent = part.value; fragment.appendChild(span); break; } }); root.appendChild(fragment); ]]> 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; } // Convert to a valid date string according to: // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-date-string year = year.toString().padStart(this.mYearLength, "0"); month = (month < 10) ? ("0" + month) : month; day = (day < 10) ? ("0" + day) : day; let date = [year, month, day].join("-"); this.log("setInputValueFromFields: " + date); this.mInputElement.setUserInput(date); ]]> = 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); ]]> max) { value = max; } } aField.setAttribute("rawValue", value); // Display formatted value based on locale. let minDigits = aField.getAttribute("mindigits"); let formatted = value.toLocaleString(this.mLocales, { minimumIntegerDigits: minDigits, useGrouping: false }); aField.textContent = formatted; this.updateResetButtonVisibility(); ]]> "&time.hour.placeholder;""&time.minute.placeholder;""&time.second.placeholder;""&time.millisecond.placeholder;""&time.dayperiod.placeholder;" { switch (part.type) { case "hour": fragment.appendChild(this.mHourField); break; case "minute": fragment.appendChild(this.mMinuteField); break; case "second": fragment.appendChild(this.mSecondField); if (millisecond != undefined) { // Intl.DateTimeFormat does not support millisecond, so we // need to handle this on our own. let span = document.createElementNS(HTML_NS, "span"); span.textContent = this.mMillisecSeparatorText; fragment.appendChild(span); fragment.appendChild(this.mMillisecField); } break; case "dayPeriod": fragment.appendChild(this.mDayPeriodField); break; default: let span = document.createElementNS(HTML_NS, "span"); span.textContent = part.value; fragment.appendChild(span); break; } }); root.appendChild(fragment); ]]> result.values[key]); return { amString, pmString }; ]]> = this.mMaxHour ? this.mPMIndicator : this.mAMIndicator); } if (!this.isEmpty(second)) { this.setFieldValue(this.mSecondField, second); } if (!this.isEmpty(millisecond)) { this.setFieldValue(this.mMillisecField, millisecond); } this.notifyPicker(); ]]> = this.mMaxHour ? 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); ]]> = maxLength || n * 10 > max) { buffer = ""; this.advanceToNextField(); } targetField.setAttribute("typeBuffer", buffer); } ]]> this.mMaxHour) ? value % this.mMaxHour : value; } } else if (value > this.mMaxHour) { value = this.mMaxHour; } } aField.setAttribute("rawValue", value); let minDigits = aField.getAttribute("mindigits"); let formatted = value.toLocaleString(this.mLocales, { minimumIntegerDigits: minDigits, useGrouping: false }); aField.textContent = formatted; this.updateResetButtonVisibility(); ]]> { 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 is to close the picker when input element blurs. this.mInputElement.addEventListener("blur", this, { mozSystemGroup: true }); ]]> { this.removeEventListener(eventName, this, { mozSystemGroup: true }); }); this.removeEventListener("keypress", this, { 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; throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED;