mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 04:32:16 +08:00
Set blank default date for added_on repository filters [SCI-8744]
This commit is contained in:
parent
9421ef3312
commit
973d65ca00
3 changed files with 12 additions and 6 deletions
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue