[events] Create empty models from factory function (fresh objects)
This commit is contained in:
parent
7d1993e3fa
commit
5780c73608
|
@ -13,15 +13,23 @@ export type EditableJob = Omit<Omit<FG.Job, 'type'>, 'id'> & {
|
|||
id?: number;
|
||||
};
|
||||
|
||||
export const emptyJob: EditableJob = {
|
||||
start: new Date(),
|
||||
end: date.addToDate(new Date(), { hours: 1 }),
|
||||
export const emptyJob = (d: Date | number = new Date()): EditableJob =>
|
||||
Object.assign(
|
||||
{},
|
||||
{
|
||||
start: date.adjustDate(d, { minutes: 0, seconds: 0 }),
|
||||
end: date.addToDate(date.adjustDate(d, { minutes: 0, seconds: 0 }), { hours: 1 }),
|
||||
services: [],
|
||||
required_services: 2,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
export const emptyEvent: EditableEvent = {
|
||||
start: new Date(),
|
||||
jobs: [Object.assign({}, emptyJob)],
|
||||
export const emptyEvent = (d: Date | number = new Date()): EditableEvent =>
|
||||
Object.assign(
|
||||
{},
|
||||
{
|
||||
start: date.adjustDate(d, { hours: 0, minutes: 0, seconds: 0 }),
|
||||
jobs: [],
|
||||
is_template: false,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue