Fix Types

This commit is contained in:
Lorenz Padberg 2023-06-30 10:48:31 +02:00
parent acbeb82184
commit 57143a0209
3 changed files with 17 additions and 7 deletions

View File

@ -3,13 +3,14 @@ import { getDateString, getTimeString } from "@/components/dueDates/dueDatesUtil
import type { Dayjs } from "dayjs"; import type { Dayjs } from "dayjs";
const props = defineProps<{ const props = defineProps<{
singleDate: Dayjs; singleDate?: Dayjs;
}>(); }>();
</script> </script>
<template> <template>
<span> <span>
<it-icon-calendar-light class="it-icon h-5 w-5" /> <it-icon-calendar-light class="it-icon h-5 w-5" />
// TODO: Termin nicht definiert anzeigen wenn undefined
{{ getDateString(props.singleDate) }}, {{ getTimeString(props.singleDate) }} {{ getDateString(props.singleDate) }}, {{ getTimeString(props.singleDate) }}
</span> </span>
</template> </template>

View File

@ -28,14 +28,23 @@ export const formatDate = (start: Dayjs, end: Dayjs) => {
)}`; )}`;
}; };
export const getTimeString = (date: Dayjs) => { export const getTimeString = (date?: Dayjs) => {
return `${date.format("H:mm")}`; if (date) {
return `${date.format("H:mm")}`;
}
return "";
}; };
export const getDateString = (date: Dayjs) => { export const getDateString = (date?: Dayjs) => {
return `${date.format("D. MMMM YYYY")}`; if (date) {
return `${date.format("D. MMMM YYYY")}`;
}
return "";
}; };
export const getWeekday = (date: Dayjs) => { export const getWeekday = (date: Dayjs) => {
return `${date.format("dd")}`; if (date) {
return `${date.format("dd")}`;
}
return "";
}; };

View File

@ -239,7 +239,7 @@ export const useCourseSessionsStore = defineStore("courseSessions", () => {
contentId?: number contentId?: number
): CourseSessionAssignmentDetails | undefined { ): CourseSessionAssignmentDetails | undefined {
if (contentId && currentCourseSession.value) { if (contentId && currentCourseSession.value) {
return []; return;
// TODO: Commented out because DueDate replaced assignment_details_list, not shure if other iformation is needed // TODO: Commented out because DueDate replaced assignment_details_list, not shure if other iformation is needed
// currentCourseSession.value.assignment_details_list.find( // currentCourseSession.value.assignment_details_list.find(
// (assignmentDetails) => assignmentDetails.learningContentId === contentId // (assignmentDetails) => assignmentDetails.learningContentId === contentId