Set blank default date for added_on repository filters [SCI-8744]

This commit is contained in:
wandji20 2023-07-05 07:30:37 +01:00
parent 9421ef3312
commit 973d65ca00
3 changed files with 12 additions and 6 deletions

View file

@ -11,7 +11,7 @@
<template v-if="!isPreset">
<div class="datetime-filter-attributes">
<div class="filter-datepicker-input">
<DateTimePicker @change="updateDate" :selectorId="`DatePicker${filter.id}`" :defaultValue="date || fallbackDate()" />
<DateTimePicker @change="updateDate" :selectorId="`DatePicker${filter.id}`" :defaultValue="null" />
</div>
<div class="between-delimiter vertical" v-if="operator == 'between'"></div>
<div class="filter-datepicker-to-input">

View file

@ -1,6 +1,6 @@
<template>
<div class="datepicker sci-input-container right-icon">
<input @change="update" type="datetime" class="form-control calendar-input sci-input-field" :id="this.selectorId" placeholder="" />
<input @change="update" type="datetime" class="form-control calendar-input sci-input-field" :id="this.selectorId" placeholder="dd/mm/yyyy" />
<i class="sn-icon sn-icon-calendar"></i>
</div>
</template>
@ -11,7 +11,7 @@
props: {
selectorId: { type: String, required: true },
useCurrent: { type: Boolean, default: true },
defaultValue: { type: Date, default: true }
defaultValue: { type: Date, default: null }
},
mounted() {
$("#" + this.selectorId).datetimepicker(
@ -22,14 +22,19 @@
format: this.dateFormat,
date: this.defaultValue
}
);
this.update($("#" + this.selectorId).data("DateTimePicker").date());
);
if(this.isValidDate(this.defaultValue)) {
this.update($("#" + this.selectorId).data("DateTimePicker").date());
}
$("#" + this.selectorId).on('dp.change', (e) => this.update(e.date))
},
methods: {
update(value) {
this.$emit('change', (value._isAMomentObject) ? value.toDate() : '');
}
},
isValidDate(date) {
return (date instanceof Date) && !isNaN(date.getTime());
},
}
}
</script>

View file

@ -34,6 +34,7 @@
this.updateDateTime();
},
getTime(dateTime) {
if(!this.isValidDate(dateTime)) return
return `${dateTime.getHours().toString().padStart(2, '0')}:${dateTime.getMinutes().toString().padStart(2, '0')}`
},
updateTime(value) {