From be77c3729b7700b5827482d9346d544dd7dca62e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 20 Apr 2022 14:09:28 +0200 Subject: [PATCH] take empty date strings into account --- .../public/vuejs/AccompanyingCourse/store/index.js | 3 ++- .../public/vuejs/AccompanyingCourseWorkEdit/store.js | 6 +++--- .../public/vuejs/HouseholdMembersEditor/store/index.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index 5d73aa2ed..57415565b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -814,7 +814,8 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou }, updateStartDate({commit}, payload) { const url = `/api/1.0/person/accompanying-course/${id}.json`; - const body = { type: "accompanying_period", openingDate: { datetime: datetimeToISO(ISOToDate(payload)) }}; + const date = payload === null || payload === '' ? null : { datetime: datetimeToISO(ISOToDate(payload)) } + const body = { type: "accompanying_period", openingDate: date}; return makeFetch('PATCH', url, body) .then((response) => { commit('updateStartDate', response.openingDate); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index 77cc4800e..502704716 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -111,9 +111,9 @@ const store = createStore({ id: e.evaluation.id, type: e.evaluation.type }, - 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, + startDate: e.startDate === null || e.startDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.startDate)) }, + endDate: e.endDate === null || e.endDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.endDate)) }, + maxDate: e.maxDate === null || e.maxDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.maxDate)) }, warningInterval: intervalDaysToISO(e.warningInterval), comment: e.comment, documents: e.documents diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js index 87e465a8d..75b3c215f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js @@ -278,7 +278,7 @@ const store = createStore({ type: conc.person.type }, start_date: { - datetime: datetimeToISO(ISOToDate(state.startDate)) + datetime: state.startDate === null || state.startDate === '' ? null : datetimeToISO(ISOToDate(state.startDate)) } };