Skip to content

Commit

Permalink
Apply suggestion: move datetime conversion to the script section
Browse files Browse the repository at this point in the history
  • Loading branch information
TeodoraPavlova committed Apr 9, 2024
1 parent ab58a10 commit d262738
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/components/inputs/DateTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<BaseInput :label="label" :args="args" :vertical="vertical" :required="required">
<template v-slot:field>
<input class="form-control" type="datetime-local"
:value="modelValue && convertToDateTimeLocalString(modelValue)"
:value="value"
@input="onInput"
v-bind="args"/>
</template>
Expand All @@ -16,6 +16,11 @@ 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);
Expand Down

0 comments on commit d262738

Please sign in to comment.