tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 16bb714ac1314f5cafdfa162a66f0d8e33ebb7b1
parent 6854b83e2ef14ba08c409f5420b9e94419f9b0db
Author: Kagami Sascha Rosylight <krosylight@proton.me>
Date:   Wed, 10 Dec 2025 17:31:10 +0000

Bug 2005267 - Remove redundant setInputBoxValue parameter from DateTimePickerPanel r=emilio

This also changes the behavior behind `dom.forms.datetime.timepicker` which is currently disabled by default.

The current behavior tries to be clever - only the fields changed by the user are updated. But the picker already visually selects every field, so it's just confusing to not indicate that in the input element too.

The new behavior follows Chrome - if the user changed either hour or minute, then the other is also updated in the input element.

Note that picking date doesn't set time and thus the datetime-local behavior is not affected and keeps the time fields empty.

Differential Revision: https://phabricator.services.mozilla.com/D275823

Diffstat:
Mtoolkit/modules/DateTimePickerPanel.sys.mjs | 22+++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/toolkit/modules/DateTimePickerPanel.sys.mjs b/toolkit/modules/DateTimePickerPanel.sys.mjs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -export var DateTimePickerPanel = class { +export class DateTimePickerPanel { constructor(element) { this.element = element; @@ -159,10 +159,7 @@ export var DateTimePickerPanel = class { }); } - /** - * @param {boolean} passAllValues: Pass spinner values regardless if they've been set/changed or not - */ - setInputBoxValue(passAllValues) { + setInputBoxValue() { const value = { year: this.pickerState.year, month: this.pickerState.month, @@ -170,19 +167,6 @@ export var DateTimePickerPanel = class { hour: this.pickerState.hour, minute: this.pickerState.minute, }; - if (this.type !== "date") { - const isNoValueSet = - this.pickerState.isHourSet || - this.pickerState.isMinuteSet || - this.pickerState.isDayPeriodSet; - if (!passAllValues || isNoValueSet) { - value.hour = - this.pickerState.isHourSet || this.pickerState.isDayPeriodSet - ? value.hour - : undefined; - value.minute = this.pickerState.isMinuteSet ? value.minute : undefined; - } - } this.sendPickerValueChanged(value); } @@ -286,4 +270,4 @@ export var DateTimePickerPanel = class { this.dateTimePopupFrame.contentWindow.postMessage(data, "*"); } } -}; +}