add date for movement editor

This commit is contained in:
2021-06-03 22:09:52 +02:00
parent d9a3e117b2
commit 502a629dc8
3 changed files with 49 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
<template>
<h2>{{ $t('household_member_editor.dates_title') }}</h2>
<p>
<label for="start_date">
{{ $t('household_member_editor.dates.start_date') }}
</label>
<input type="date" v-model="startDate" />
</p>
</template>
<script>
export default {
name: 'Dates',
computed: {
startDate: {
get() {
return [
this.$store.state.startDate.getFullYear(),
(this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
this.$store.state.startDate.getDate().toString().padStart(2, '0')
].join('-');
},
set(value) {
let
[year, month, day] = value.split('-'),
dValue = new Date(year, month-1, day);
this.$store.dispatch('setStartDate', dValue);
}
}
}
}
</script>