scinote-web/app/javascript/vue/shared/date_picker.vue
aignatov-bio 8fcf4e9aa2
Add styling for repository filters [SCI-6232] (#3779)
Co-authored-by: Anton <anton@scinote.net>
2022-01-17 10:24:57 +01:00

33 lines
888 B
Vue

<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="" />
<i class="fas fa-calendar-alt"></i>
</div>
</template>
<script>
export default {
name: 'DatePicker',
props: {
selectorId: { type: String, required: true },
useCurrent: { type: Boolean, default: true }
},
mounted() {
$("#" + this.selectorId).datetimepicker(
{
useCurrent: this.useCurrent,
ignoreReadonly: this.ignoreReadOnly,
locale: this.i18n.locale,
format: this.dateFormat
}
);
$("#" + this.selectorId).on('dp.change', (e) => this.update(e.date))
},
methods: {
update(value) {
this.$emit('change', value.toDate());
}
}
}
</script>