Tofu/app/tools/planning/createEmptyWeekPlanning.js

11 lines
437 B
JavaScript

import { formatDateKey } from '#tofu/tools/dates/formatDateKey.js'
// Builds the blank planning structure of a week: one entry per given date,
// keyed by its local date key. Dishes and ingredients start empty.
export function createEmptyWeekPlanning(weekId, dates) {
const days = Array.isArray(dates) ? dates : []
return {
weekId,
days: days.map((date) => ({ date: formatDateKey(date), dish: '', ingredients: '' })),
}
}