diff --git a/client/src/app/gateways/error-mapping/error-map-utils.ts b/client/src/app/gateways/error-mapping/error-map-utils.ts index 84e2fce0e4..88a5f824fc 100644 --- a/client/src/app/gateways/error-mapping/error-map-utils.ts +++ b/client/src/app/gateways/error-mapping/error-map-utils.ts @@ -1,5 +1,6 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; +import { MeetingAction } from '../repositories/meetings'; import { MotionAction } from '../repositories/motions'; export class MapError { @@ -39,6 +40,12 @@ const VoteServiceErrorMap: ErrorMap = new ErrorMap([ ]); const MotionCreateForwardErrorMap: ErrorMap = new ErrorMap([[/(.*)/, input => new MapError(input)]]); +const MeetingCreateErrorMap: ErrorMap = new ErrorMap([ + [ + /Only one of start_time and end_time is not allowed./, + _(`Start and end time must either both be set or both be empty`) + ] +]); /** * Finds the correct error map for an action response by the original requests action name @@ -47,6 +54,8 @@ const MotionCreateForwardErrorMap: ErrorMap = new ErrorMap([[/(.*)/, input => ne const getActionErrorMap: (data: any) => ErrorMap | null = data => { const actionName = Array.isArray(data) && typeof data[0] === `object` ? data[0][`action`] : null; switch (actionName) { + case MeetingAction.CREATE: + return MeetingCreateErrorMap; case MotionAction.CREATE_FORWARDED: return MotionCreateForwardErrorMap; default: diff --git a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts index 391bb04cad..c3029c9e4c 100644 --- a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts +++ b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts @@ -263,10 +263,12 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { const rawForm: { [key: string]: any } = { name: [``, Validators.required], location: [``], - daterange: { - start: [currentDate], - end: [currentDate] - }, + daterange: [ + { + start: currentDate, + end: currentDate + } + ], admin_ids: [[], Validators.minLength(1)], organization_tag_ids: [[]], external_id: [``]