fix datepicker for householdmember editor

This commit is contained in:
Julie Lenaerts 2022-04-06 11:24:01 +02:00
parent 66ab38c60f
commit de9d2aa885
2 changed files with 13 additions and 12 deletions

View File

@ -66,18 +66,19 @@ export default {
},
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('-');
return this.$store.state.startDate;
// 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);
// let
// [year, month, day] = value.split('-'),
// dValue = new Date(year, month-1, day);
this.$store.dispatch('setStartDate', dValue);
this.$store.dispatch('setStartDate', value);
}
}
}

View File

@ -2,7 +2,7 @@ import { createStore } from 'vuex';
import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js';
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js';
import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
const debug = process.env.NODE_ENV !== 'production';
@ -30,7 +30,7 @@ const store = createStore({
}
return 0;
}),
startDate: new Date(),
startDate: dateToISO(new Date()),
/**
* Indicates if the destination is:
*
@ -278,7 +278,7 @@ const store = createStore({
type: conc.person.type
},
start_date: {
datetime: datetimeToISO(state.startDate)
datetime: datetimeToISO(ISOToDate(state.startDate))
}
};