From 475c6e960037e6c89ab22c1c9d7d767c90fcd876 Mon Sep 17 00:00:00 2001 From: Spencer Stolworthy Date: Mon, 29 Jun 2020 16:47:42 -0600 Subject: [PATCH] added date serializer to archive_date (#217) --- .../engagement_edit_modals/engagement_summary_edit_modal.tsx | 4 +++- src/serializers/engagement/engagement_json_serializer.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/engagement_edit_modals/engagement_summary_edit_modal.tsx b/src/components/engagement_edit_modals/engagement_summary_edit_modal.tsx index 58d47eca5..6554c1e32 100644 --- a/src/components/engagement_edit_modals/engagement_summary_edit_modal.tsx +++ b/src/components/engagement_edit_modals/engagement_summary_edit_modal.tsx @@ -7,10 +7,11 @@ import { useEngagements } from '../../context/engagement_context/engagement_hook import { DescriptionFormField } from '../engagement_form_fields/description'; import { LocationFormField } from '../engagement_form_fields/location'; import { EngagementStartEndDateFormField } from '../engagement_form_fields/engagement_start_end_date'; +import { EngagementFormConfig } from '../../schemas/engagement_config'; export interface EngagementSummaryEditModalProps { onChange: (fieldName: string, value: any) => void; - formOptions: object; + formOptions: EngagementFormConfig; engagement: Engagement; isOpen: boolean; onSave: (engagement: Engagement) => void; @@ -50,6 +51,7 @@ export function EngagementSummaryEditModal( /> diff --git a/src/serializers/engagement/engagement_json_serializer.ts b/src/serializers/engagement/engagement_json_serializer.ts index e0bd635a4..4f48dfe75 100644 --- a/src/serializers/engagement/engagement_json_serializer.ts +++ b/src/serializers/engagement/engagement_json_serializer.ts @@ -47,7 +47,9 @@ export class EngagementJsonSerializer } deserialize(data: object): Engagement { return { - archive_date: data['archive_date'], + archive_date: data['archive_date'] + ? EngagementJsonSerializer.parseDate(data['archive_date']) + : undefined, commits: (data['commits'] as any[]) ?.filter(d => !(d['author_email'] === 'bot@bot.com')) ?.map(d => EngagementJsonSerializer.gitCommitSerializer.deserialize(d)),