From a1c7b6310bd15912f1126b45a999c246e2f21cd2 Mon Sep 17 00:00:00 2001 From: Rene Enriquez Date: Tue, 16 Jun 2020 13:05:55 -0500 Subject: [PATCH] fix: #392 save data using UTC --- .../modules/time-entries/pages/time-entries.component.spec.ts | 4 +++- src/app/modules/time-entries/pages/time-entries.component.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/modules/time-entries/pages/time-entries.component.spec.ts b/src/app/modules/time-entries/pages/time-entries.component.spec.ts index df47e3b3a..62b6dfa48 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.spec.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.spec.ts @@ -139,7 +139,9 @@ describe('TimeEntriesComponent', () => { it('when saving time entries, the time entries should be queried', () => { const currentMonth = new Date().getMonth() + 1; const entryToSave = { - project_id: 'project-id' + project_id: 'project-id', + end_date: new Date(), + start_date: new Date() }; component.activeTimeEntry = null; spyOn(store, 'dispatch'); diff --git a/src/app/modules/time-entries/pages/time-entries.component.ts b/src/app/modules/time-entries/pages/time-entries.component.ts index bdce87c23..574712e57 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.ts @@ -58,7 +58,9 @@ export class TimeEntriesComponent implements OnInit { doSave(entry) { entry.start_date = new Date(entry.start_date).toISOString(); - entry.end_date = new Date(entry.end_date).toISOString(); + if (entry.end_date !== null && entry.end_date !== undefined) { + entry.end_date = new Date(entry.end_date).toISOString(); + } if (this.entryId) { entry.id = this.entryId; this.store.dispatch(new entryActions.UpdateEntry(entry));