parsley/app/javascript/components/AppDatePicker.vue

42 lines
740 B
Vue
Raw Normal View History

2018-04-13 23:32:34 -05:00
<template>
<app-text-field :value="stringValue" @input="input" :label="label" type="date"></app-text-field>
</template>
<script>
import DateTimeUtils from "../lib/DateTimeUtils";
export default {
props: {
value: {
required: false,
2018-04-15 14:15:42 -05:00
type: [Date, String]
2018-04-13 23:32:34 -05:00
},
label: {
required: false,
type: String,
default: null
}
},
computed: {
stringValue() {
2018-04-15 14:15:42 -05:00
const d = DateTimeUtils.toDate(this.value);
return DateTimeUtils.formatDateForEdit(d);
2018-04-13 23:32:34 -05:00
}
},
methods: {
input(val) {
let d = DateTimeUtils.toDate(val + " 00:00");
this.$emit("input", d);
}
}
}
</script>
<style lang="scss" scoped>
</style>