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";
const props = defineProps<{
singleDate: Dayjs;
singleDate?: Dayjs;
}>();
</script>
<template>
<span>
<it-icon-calendar-light class="it-icon h-5 w-5" />
// TODO: Termin nicht definiert anzeigen wenn undefined
{{ getDateString(props.singleDate) }}, {{ getTimeString(props.singleDate) }}
</span>
</template>

View File

@ -28,14 +28,23 @@ export const formatDate = (start: Dayjs, end: Dayjs) => {
)}`;
};
export const getTimeString = (date: Dayjs) => {
return `${date.format("H:mm")}`;
export const getTimeString = (date?: Dayjs) => {
if (date) {
return `${date.format("H:mm")}`;
}
return "";
};
export const getDateString = (date: Dayjs) => {
return `${date.format("D. MMMM YYYY")}`;
export const getDateString = (date?: Dayjs) => {
if (date) {
return `${date.format("D. MMMM YYYY")}`;
}
return "";
};
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
): CourseSessionAssignmentDetails | undefined {
if (contentId && currentCourseSession.value) {
return [];
return;
// TODO: Commented out because DueDate replaced assignment_details_list, not shure if other iformation is needed
// currentCourseSession.value.assignment_details_list.find(
// (assignmentDetails) => assignmentDetails.learningContentId === contentId