Set start of empty event model to midnight

This commit is contained in:
Ferdinand Thiessen 2021-11-25 15:38:02 +01:00
parent f87c691f61
commit f539d2c386
1 changed files with 2 additions and 5 deletions

View File

@ -16,9 +16,6 @@ export type EditableJob = Omit<Omit<FG.Job, 'type'>, 'id'> & {
export function emptyJob(startDate = new Date()): EditableJob { export function emptyJob(startDate = new Date()): EditableJob {
const start = date.adjustDate(startDate, { const start = date.adjustDate(startDate, {
hours: new Date().getHours(), hours: new Date().getHours(),
minutes: 0,
seconds: 0,
milliseconds: 0,
}); });
return { return {
start: start, 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 { return {
start: startDate === undefined ? new Date() : new Date(startDate), start: date.adjustDate(startDate, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }),
jobs: [emptyJob(startDate)], jobs: [emptyJob(startDate)],
is_template: false, is_template: false,
}; };