From b6ab0bc552f2e792c42f2527dc2e7c908ffdf496 Mon Sep 17 00:00:00 2001 From: Dlurak <84224239+Dlurak@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:51:00 +0100 Subject: [PATCH] :children_crossing: Change the default value for the timepicker in the createhomework components --- src/lib/homework/CreateHomework.svelte | 8 +++--- src/lib/homework/CreateHomeworkInner.svelte | 27 ++++++++------------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/lib/homework/CreateHomework.svelte b/src/lib/homework/CreateHomework.svelte index eaaa971..b1f15f5 100644 --- a/src/lib/homework/CreateHomework.svelte +++ b/src/lib/homework/CreateHomework.svelte @@ -13,21 +13,19 @@ import { addToast } from '$lib/toast/addToast'; import { network } from '../../stores'; import { backendUrl } from '$lib/../stores'; + import { getOneWeekFromNow } from '../../constants/generateDates'; export let postSubmit: (e: Event) => void = () => { return; }; - const currentDate = new Date(); - let date = createDate(currentDate); - let assignedAtDateObj: CustomDate; let assignments: Assignment[] = [ { subject: '', description: '', - due: date + due: createDate(getOneWeekFromNow()) } ]; @@ -73,7 +71,7 @@ { subject: '', description: '', - due: date + due: createDate(getOneWeekFromNow()) } ]; diff --git a/src/lib/homework/CreateHomeworkInner.svelte b/src/lib/homework/CreateHomeworkInner.svelte index 324b7a7..bbe2c54 100644 --- a/src/lib/homework/CreateHomeworkInner.svelte +++ b/src/lib/homework/CreateHomeworkInner.svelte @@ -8,17 +8,17 @@ import I18n from '$lib/I18n.svelte'; import { i } from '../../languages/i18n'; import { subjectsSortetCapitalized } from '../../constants/subjecticons'; + import { getOneWeekFromNow } from '../../constants/generateDates'; - const currentDate = new Date(); - let date = createDate(currentDate); + let date = createDate(getOneWeekFromNow()); - export let assignments: Assignment[] = [ - { - subject: '', - description: '', - due: date - } - ]; + const emptyAssignment: Assignment = { + subject: '', + description: '', + due: date + }; + + export let assignments: Assignment[] = [emptyAssignment];