Skip to content

Commit

Permalink
Range Filter Improvements: Update event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mgbaybay committed Dec 12, 2024
1 parent b972050 commit 8606ed2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions ui/src/core/xibo-cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ window.XiboInitialise = function(scope, options) {
// Search for any grids on the page and render them
$(scope + ' .XiboGrid').each(function(_idx, el) {
// Custom Date Range Filter
$(el).find('select.XiboDateRangeFilter').on('change', function() {
updateDateRangeFilter(this);
$(el).find('select.XiboDateRangeFilter').on('change', function(ev) {
updateDateRangeFilter(ev.currentTarget);
});
});

Expand Down Expand Up @@ -3160,11 +3160,9 @@ function updateDateRangeSelection($form, selectFilterId) {

$(`.rangeFilterInput_${selectFilterId}`).on('change', function() {
fromDt = moment($(`#fromDt_${selectFilterId}`).val())
.startOf('day')
.format();
.startOf('day').format();
toDt = moment($(`#toDt_${selectFilterId}`).val())
.endOf('day')
.format();
.endOf('day').format();

const dateDiff = moment(toDt).diff(moment(fromDt), 'days');

Expand All @@ -3186,11 +3184,9 @@ function updateDateRangeSelection($form, selectFilterId) {
*/
function formatInputFields($form, selectFilterId, fromDt, toDt) {
$form.find(`#fromDt_${selectFilterId}`)
.val(moment(fromDt)
.format('YYYY-MM-DD HH:mm:ss'));
.val(moment(fromDt).format('YYYY-MM-DD HH:mm:ss'));
$form.find(`#toDt_${selectFilterId}`)
.val(moment(toDt)
.format('YYYY-MM-DD HH:mm:ss'));
.val(moment(toDt).format('YYYY-MM-DD HH:mm:ss'));
}

window.moveFolderMultiSelectFormOpen = function(dialog) {
Expand Down

0 comments on commit 8606ed2

Please sign in to comment.