fix: bug in assignment vertalingen

This commit is contained in:
Joyelle Ndagijimana 2025-05-17 19:07:52 +02:00
parent f67e3f5a1a
commit 0abe9b1bce
4 changed files with 37 additions and 119 deletions

View file

@ -1,6 +1,5 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { deadlineRules } from "@/utils/assignment-rules.ts";
const emit = defineEmits<(e: "update:deadline", value: Date | null) => void>();
const props = defineProps<{ deadline: Date | null }>();
@ -19,6 +18,24 @@
emit("update:deadline", null);
}
});
const deadlineRules = [
(value: string): string | boolean => {
const selectedDateTime = new Date(value);
const now = new Date();
if (isNaN(selectedDateTime.getTime())) {
return t("deadline-invalid");
}
if (selectedDateTime <= now) {
return t("deadline-past");
}
return true;
},
];
</script>
<template>