fix datepicker for social action edit form.

still a problem with the display of already set evaluation dates... need to be transformed to correct format to display
This commit is contained in:
Julie Lenaerts 2022-04-06 11:26:04 +02:00
parent de9d2aa885
commit 65e6471a02
3 changed files with 18 additions and 18 deletions

View File

@ -439,18 +439,18 @@ export default {
]),
startDate: {
get() {
return dateToISO(this.$store.state.startDate);
return this.$store.state.startDate;
},
set(v) {
this.$store.commit('setStartDate', ISOToDate(v));
this.$store.commit('setStartDate', v);
}
},
endDate: {
get() {
return dateToISO(this.$store.state.endDate);
return this.$store.state.endDate;
},
set(v) {
this.$store.commit('setEndDate', ISOToDate(v));
this.$store.commit('setEndDate', v);
}
},
note: {

View File

@ -309,26 +309,26 @@ export default {
},
startDate: {
get() {
return dateToISO(this.evaluation.startDate);
return this.evaluation.startDate;
},
set(v) {
this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: ISOToDate(v) });
this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: v });
}
},
endDate: {
get() {
return dateToISO(this.evaluation.endDate);
return this.evaluation.endDate;
},
set(v) {
this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: ISOToDate(v) });
this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: v });
}
},
maxDate: {
get() {
return dateToISO(this.evaluation.maxDate);
return this.evaluation.maxDate;
},
set(v) {
this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: ISOToDate(v) });
this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: v });
}
},
warningInterval: {

View File

@ -1,5 +1,5 @@
import { createStore } from 'vuex';
import { datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js';
import { dateToISO, ISOToDate, datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js';
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
import { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
@ -13,9 +13,9 @@ const store = createStore({
state: {
work: window.accompanyingCourseWork,
startDate: window.accompanyingCourseWork.startDate !== null ?
ISOToDatetime(window.accompanyingCourseWork.startDate.datetime) : null,
dateToISO(new Date(window.accompanyingCourseWork.startDate.datetime)) : null,
endDate: window.accompanyingCourseWork.endDate !== null ?
ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null,
dateToISO(new Date(window.accompanyingCourseWork.endDate.datetime)) : null,
note: window.accompanyingCourseWork.note,
goalsPicked: window.accompanyingCourseWork.goals,
goalsForAction: [],
@ -73,10 +73,10 @@ const store = createStore({
type: 'accompanying_period_work',
id: state.work.id,
startDate: state.startDate === null ? null : {
datetime: datetimeToISO(state.startDate)
datetime: datetimeToISO(ISOToDate(state.startDate))
},
endDate: state.endDate === null ? null : {
datetime: datetimeToISO(state.endDate)
datetime: datetimeToISO(ISOToDate(state.endDate))
},
note: state.note,
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
@ -110,9 +110,9 @@ const store = createStore({
id: e.evaluation.id,
type: e.evaluation.type
},
startDate: e.startDate !== null ? { datetime: datetimeToISO(e.startDate) } : null,
endDate: e.endDate !== null ? { datetime: datetimeToISO(e.endDate) } : null,
maxDate: e.maxDate !== null ? { datetime: datetimeToISO(e.maxDate) } : null,
startDate: e.startDate !== null ? { datetime: datetimeToISO(ISOToDate(e.startDate)) } : null,
endDate: e.endDate !== null ? { datetime: datetimeToISO(ISOToDate(e.endDate)) } : null,
maxDate: e.maxDate !== null ? { datetime: datetimeToISO(ISOToDate(e.maxDate)) } : null,
warningInterval: intervalDaysToISO(e.warningInterval),
comment: e.comment,
documents: e.documents