mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-06 15:40:31 +08:00
a1e6392a45
* Fix bugs with jquery3 upgrade [SCI-8973] * Remove deprecated jquery method (.error, .completed, .success) [SCI-8973] * Fix linter error [SCI-8973]
44 lines
1.2 KiB
Vue
44 lines
1.2 KiB
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='dd/mm/yyyy'
|
|
/>
|
|
<i class="sn-icon sn-icon-calendar"></i>
|
|
</div>
|
|
</template>
|
|
import '../../../../vendor/assets/javascripts/bootstrap-datetimepicker';
|
|
|
|
<script>
|
|
export default {
|
|
name: 'DatePicker',
|
|
props: {
|
|
selectorId: { type: String, required: true },
|
|
useCurrent: { type: Boolean, default: true },
|
|
defaultValue: { type: Date, default: null }
|
|
},
|
|
mounted() {
|
|
$("#" + this.selectorId).datetimepicker(
|
|
{
|
|
useCurrent: this.useCurrent,
|
|
ignoreReadonly: this.ignoreReadOnly,
|
|
locale: this.i18n.locale,
|
|
format: this.dateFormat,
|
|
date: this.defaultValue
|
|
}
|
|
);
|
|
$("#" + 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>
|