Skip to content

Commit

Permalink
Fix DateTime attribute field value does not get rendered on Entity ed…
Browse files Browse the repository at this point in the history
…it (#202)
  • Loading branch information
TeodoraPavlova authored Apr 11, 2024
1 parent 914bc16 commit 040b0c6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion frontend/src/components/inputs/DateTime.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<BaseInput :label="label" :args="args" :vertical="vertical" :required="required">
<template v-slot:field>
<input class="form-control" type="datetime-local" :value="modelValue" @input="onInput"
<input class="form-control" type="datetime-local"
:value="value"
@input="onInput"
v-bind="args"/>
</template>
</BaseInput>
Expand All @@ -14,10 +16,22 @@ export default {
name: "DateTime",
components: {BaseInput},
props: ["label", "modelValue", "args", "vertical", "required"],
computed: {
value() {
return this.modelValue && this.convertToDateTimeLocalString(this.modelValue);
}
},
methods: {
onInput(event) {
this.$emit("update:modelValue", event.target.value);
},
convertToDateTimeLocalString(date) {
if (!(date instanceof Date)) {
date = new Date(date)
}
return date.toISOString().substring(0, 16);
}
},
};
</script>

0 comments on commit 040b0c6

Please sign in to comment.