summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/datepicker.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/content/widgets/datepicker.js')
-rw-r--r--toolkit/content/widgets/datepicker.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/toolkit/content/widgets/datepicker.js b/toolkit/content/widgets/datepicker.js
index f5659b736..4387ae632 100644
--- a/toolkit/content/widgets/datepicker.js
+++ b/toolkit/content/widgets/datepicker.js
@@ -124,7 +124,7 @@ function DatePicker(context) {
/**
* Update date picker and its components.
*/
- _update() {
+ _update(options = {}) {
const { dateKeeper, isMonthPickerVisible } = this.state;
if (isMonthPickerVisible) {
@@ -139,7 +139,8 @@ function DatePicker(context) {
dateObj: dateKeeper.state.dateObj,
months: this.state.months,
years: this.state.years,
- toggleMonthPicker: this.state.toggleMonthPicker
+ toggleMonthPicker: this.state.toggleMonthPicker,
+ noSmoothScroll: options.noSmoothScroll
});
this.components.calendar.setProps({
isVisible: !isMonthPickerVisible,
@@ -260,7 +261,7 @@ function DatePicker(context) {
dateKeeper.setSelection({
year, month, day
});
- this._update();
+ this._update({ noSmoothScroll: true });
}
};
@@ -330,14 +331,14 @@ function DatePicker(context) {
items: props.months,
isInfiniteScroll: true,
isValueSet: this.state.isMonthSet,
- smoothScroll: !this.state.firstOpened
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
});
this.components.year.setState({
value: props.dateObj.getUTCFullYear(),
items: props.years,
isInfiniteScroll: false,
isValueSet: this.state.isYearSet,
- smoothScroll: !this.state.firstOpened
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
});
this.state.firstOpened = false;
} else {