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: { startDate: {
get() { get() {
return [ return this.$store.state.startDate;
this.$store.state.startDate.getFullYear(), // return [
(this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'), // this.$store.state.startDate.getFullYear(),
this.$store.state.startDate.getDate().toString().padStart(2, '0') // (this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
].join('-'); // this.$store.state.startDate.getDate().toString().padStart(2, '0')
// ].join('-');
}, },
set(value) { set(value) {
let // let
[year, month, day] = value.split('-'), // [year, month, day] = value.split('-'),
dValue = new Date(year, month-1, day); // 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 { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js' import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.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'; const debug = process.env.NODE_ENV !== 'production';
@ -30,7 +30,7 @@ const store = createStore({
} }
return 0; return 0;
}), }),
startDate: new Date(), startDate: dateToISO(new Date()),
/** /**
* Indicates if the destination is: * Indicates if the destination is:
* *
@ -278,7 +278,7 @@ const store = createStore({
type: conc.person.type type: conc.person.type
}, },
start_date: { start_date: {
datetime: datetimeToISO(state.startDate) datetime: datetimeToISO(ISOToDate(state.startDate))
} }
}; };