Skip to content

Commit 1aeb280

Browse files
committed
fix date time range single in filters
1 parent 83782cd commit 1aeb280

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/bundle/Resources/public/js/scripts/core/date.time.range.single.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,20 @@ class DateTimeRangeSingle {
4242
const days = (endDate - startDate) / secondsInDay;
4343

4444
this.periodInput.value = `P0Y0M${days}D`;
45+
this.periodInput.dispatchEvent(new Event('change'));
46+
this.periodInput.dispatchEvent(new Event('input'));
47+
4548
this.endInput.value = endDate;
49+
this.endInput.dispatchEvent(new Event('change'));
50+
this.endInput.dispatchEvent(new Event('input'));
4651
} else if (dates.length === 0) {
4752
this.periodInput.value = '';
53+
this.periodInput.dispatchEvent(new Event('change'));
54+
this.periodInput.dispatchEvent(new Event('change'));
55+
4856
this.endInput.value = '';
57+
this.endInput.dispatchEvent(new Event('change'));
58+
this.endInput.dispatchEvent(new Event('input'));
4959
}
5060
}
5161

src/bundle/Resources/public/js/scripts/filters.action.btns.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,18 @@
5757
dateInputNodes.forEach((dateInputNode) => {
5858
if (!dateInputNode.disabled) {
5959
const datePickerNode = dateInputNode.closest('.ibexa-picker');
60-
const datePickerInstance = ibexa.helpers.objectInstances.getInstance(datePickerNode);
60+
if (datePickerNode) {
61+
const datePickerInstance = ibexa.helpers.objectInstances.getInstance(datePickerNode);
6162

62-
datePickerInstance.clear();
63+
datePickerInstance.clear();
64+
}
65+
66+
const dateTimeRangeSingleNode = dateInputNode.closest('.ibexa-date-time-range-single');
67+
if (dateTimeRangeSingleNode) {
68+
const dateTimeRangeSingleInstance = ibexa.helpers.objectInstances.getInstance(dateTimeRangeSingleNode);
69+
70+
dateTimeRangeSingleInstance.setDates([]);
71+
}
6372
}
6473
});
6574
dropdownNodes.forEach((dropdownNode) => {

0 commit comments

Comments
 (0)