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: { startDate: {
get() { get() {
return dateToISO(this.$store.state.startDate); return this.$store.state.startDate;
}, },
set(v) { set(v) {
this.$store.commit('setStartDate', ISOToDate(v)); this.$store.commit('setStartDate', v);
} }
}, },
endDate: { endDate: {
get() { get() {
return dateToISO(this.$store.state.endDate); return this.$store.state.endDate;
}, },
set(v) { set(v) {
this.$store.commit('setEndDate', ISOToDate(v)); this.$store.commit('setEndDate', v);
} }
}, },
note: { note: {

View File

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

View File

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