2018-04-13 23:32:34 -05:00
|
|
|
<template>
|
2024-10-02 14:34:50 -05:00
|
|
|
<app-text-field :value="stringValue" @update:modelValue="input" :label="label" type="date"></app-text-field>
|
2018-04-13 23:32:34 -05:00
|
|
|
</template>
|
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
<script setup>
|
2018-04-13 23:32:34 -05:00
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
import { computed } from "vue";
|
2018-04-13 23:32:34 -05:00
|
|
|
import DateTimeUtils from "../lib/DateTimeUtils";
|
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
const emit = defineEmits(["update:modelValue"]);
|
|
|
|
const props = defineProps({
|
|
|
|
modelValue: {
|
|
|
|
required: false,
|
|
|
|
type: [Date, String]
|
2018-04-13 23:32:34 -05:00
|
|
|
},
|
|
|
|
|
2024-09-29 13:35:49 -05:00
|
|
|
label: {
|
|
|
|
required: false,
|
|
|
|
type: String,
|
|
|
|
default: null
|
2018-04-13 23:32:34 -05:00
|
|
|
}
|
2024-09-29 13:35:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const stringValue = computed(() => {
|
|
|
|
const d = DateTimeUtils.toDate(props.modelValue);
|
|
|
|
return DateTimeUtils.formatDateForEdit(d);
|
|
|
|
});
|
|
|
|
|
|
|
|
function input(val) {
|
|
|
|
let d = DateTimeUtils.toDate(val + " 00:00");
|
|
|
|
emit("update:modelValue", d);
|
2018-04-13 23:32:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|