Skip to content

Commit 7c1454c

Browse files
committed
after review
1 parent bc91489 commit 7c1454c

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/bundle/Resources/public/js/scripts/admin.trash.list.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@
235235
'ibexa:date-time-range-single:change',
236236
(event) => {
237237
const { dates } = event.detail;
238+
238239
if (dates.length === 2 || dates.length === 0) {
239240
formSearch.submit();
240241
}

src/bundle/Resources/public/js/scripts/core/date.time.picker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DateTimePicker {
3232
...(config.flatpickrConfig ?? {}),
3333
};
3434

35-
setInstance(this.container, this); // TODO: reove in 5.0
35+
setInstance(this.container, this); // TODO: remove in 5.0
3636
setInstance(this.fieldWrapper, this);
3737
}
3838

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { formatShortDateTime } from '../helpers/timezone.helper';
22
import { setInstance } from '../helpers/object.instances';
33

4-
const { ibexa } = window;
4+
const { ibexa, document } = window;
5+
6+
const SECONDS_IN_DAY = 86400;
57

68
class DateTimeRangeSingle {
79
constructor(config) {
810
this.container = config.container;
911
this.dateTimePickerInputWrapper = this.container.querySelector('.ibexa-date-time-range-single__date-time-picker-input-wrapper');
1012

1113
const { periodSelector, endSelector } = this.container.dataset;
12-
this.periodInput = window.document.querySelector(periodSelector);
13-
this.endInput = window.document.querySelector(endSelector);
14+
this.periodInput = document.querySelector(periodSelector);
15+
this.endInput = document.querySelector(endSelector);
1416

1517
const customDateConfig = config.dateConfig || {};
1618
this.dateConfig = {
@@ -38,8 +40,7 @@ class DateTimeRangeSingle {
3840
if (dates.length === 2) {
3941
const startDate = this.getUnixTimestampUTC(dates[0]);
4042
const endDate = this.getUnixTimestampUTC(dates[1]);
41-
const secondsInDay = 86400;
42-
const days = (endDate - startDate) / secondsInDay;
43+
const days = (endDate - startDate) / SECONDS_IN_DAY;
4344

4445
this.periodInput.value = `P0Y0M${days}D`;
4546
this.periodInput.dispatchEvent(new Event('change'));
@@ -51,7 +52,7 @@ class DateTimeRangeSingle {
5152
} else if (dates.length === 0) {
5253
this.periodInput.value = '';
5354
this.periodInput.dispatchEvent(new Event('change'));
54-
this.periodInput.dispatchEvent(new Event('change'));
55+
this.periodInput.dispatchEvent(new Event('input'));
5556

5657
this.endInput.value = '';
5758
this.endInput.dispatchEvent(new Event('change'));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
}
6565

6666
const dateTimeRangeSingleNode = dateInputNode.closest('.ibexa-date-time-range-single');
67+
6768
if (dateTimeRangeSingleNode) {
6869
const dateTimeRangeSingleInstance = ibexa.helpers.objectInstances.getInstance(dateTimeRangeSingleNode);
6970

0 commit comments

Comments
 (0)