zlnortheastern / kanbas-quizzes-group9

MIT License
0 stars 0 forks source link

grading form是不是写错了,以及 dueDate的作用是啥? #19

Closed lemonzeng closed 3 months ago

lemonzeng commented 3 months ago

image image

代码中没有用到dueDate:

const getAvailability = (quiz: any) => {
    const currentDate = new Date();
    const availableDate = new Date(quiz.availableDate);
    const dueDate = new Date(quiz.dueDate);
    const availableUntilDate = new Date(quiz.availableUntilDate);
    if (currentDate > availableUntilDate) {
      return "Closed";
    } else if (
      currentDate >= availableDate &&
      currentDate <= availableUntilDate
    ) {
      return "Available";
    } else if (currentDate < availableDate) {
      return `Not available until ${formatDate(quiz.availableDate)}`;
    } else {
      return "Closed";
    }
  };