From f539d2c3869fa3f94aad3cbfcc273d63fe151b4c Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 25 Nov 2021 15:38:02 +0100 Subject: [PATCH] Set start of empty event model to midnight --- src/store/models.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/store/models.ts b/src/store/models.ts index ec45877..0b10f28 100644 --- a/src/store/models.ts +++ b/src/store/models.ts @@ -16,9 +16,6 @@ export type EditableJob = Omit, 'id'> & { export function emptyJob(startDate = new Date()): EditableJob { const start = date.adjustDate(startDate, { hours: new Date().getHours(), - minutes: 0, - seconds: 0, - milliseconds: 0, }); return { start: start, @@ -29,9 +26,9 @@ export function emptyJob(startDate = new Date()): EditableJob { }; } -export function emptyEvent(startDate?: Date): EditableEvent { +export function emptyEvent(startDate: Date = new Date()): EditableEvent { return { - start: startDate === undefined ? new Date() : new Date(startDate), + start: date.adjustDate(startDate, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }), jobs: [emptyJob(startDate)], is_template: false, };