mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
adjusting dates to be human friendly
This commit is contained in:
@@ -42,7 +42,14 @@ const parseDateOrThrow = (value: string, label: string): string => {
|
|||||||
if (isNaN(date.getTime())) {
|
if (isNaN(date.getTime())) {
|
||||||
throw new Error(`Error with ${label}: ${value}`);
|
throw new Error(`Error with ${label}: ${value}`);
|
||||||
}
|
}
|
||||||
return date.toISOString();
|
const day = String(date.getDate()).padStart(2, "0");
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const hours = String(date.getHours()).padStart(2, "0");
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, "0");
|
||||||
|
|
||||||
|
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const parseDateOrNull = (value: string): string | undefined => {
|
const parseDateOrNull = (value: string): string | undefined => {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "here is the description",
|
description: "here is the description",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: new Date().toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
rubric: [
|
rubric: [
|
||||||
@@ -32,8 +32,8 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "here is the description",
|
description: "here is the description",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: new Date().toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
rubric: [],
|
rubric: [],
|
||||||
@@ -52,8 +52,8 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "here is the description",
|
description: "here is the description",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: new Date().toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
submissionTypes: [],
|
submissionTypes: [],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
rubric: [
|
rubric: [
|
||||||
@@ -75,7 +75,7 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "here is the description",
|
description: "here is the description",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: undefined,
|
lockAt: undefined,
|
||||||
submissionTypes: [],
|
submissionTypes: [],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
@@ -98,8 +98,8 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "",
|
description: "",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: new Date().toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
submissionTypes: [],
|
submissionTypes: [],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
rubric: [
|
rubric: [
|
||||||
@@ -121,8 +121,8 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "test assignment\n---\nsomestuff",
|
description: "test assignment\n---\nsomestuff",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: new Date().toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
submissionTypes: [],
|
submissionTypes: [],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
rubric: [],
|
rubric: [],
|
||||||
@@ -141,8 +141,8 @@ describe("AssignmentMarkdownTests", () => {
|
|||||||
const assignment: LocalAssignment = {
|
const assignment: LocalAssignment = {
|
||||||
name: "test assignment",
|
name: "test assignment",
|
||||||
description: "here is the description",
|
description: "here is the description",
|
||||||
dueAt: new Date().toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
lockAt: new Date().toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||||
allowedFileUploadExtensions: ["pdf", "txt"],
|
allowedFileUploadExtensions: ["pdf", "txt"],
|
||||||
localAssignmentGroupName: "Final Project",
|
localAssignmentGroupName: "Final Project",
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
localAssignmentGroupName: "Assignments",
|
localAssignmentGroupName: "Assignments",
|
||||||
@@ -29,8 +29,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
showCorrectAnswers: false,
|
showCorrectAnswers: false,
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
@@ -49,8 +49,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
localAssignmentGroupName: "Assignments",
|
localAssignmentGroupName: "Assignments",
|
||||||
@@ -76,8 +76,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
localAssignmentGroupName: "Assignments",
|
localAssignmentGroupName: "Assignments",
|
||||||
@@ -103,8 +103,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
localAssignmentGroupName: "Assignments",
|
localAssignmentGroupName: "Assignments",
|
||||||
@@ -133,8 +133,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
password: undefined,
|
password: undefined,
|
||||||
@@ -164,8 +164,8 @@ describe("QuizDeterministicChecks", () => {
|
|||||||
const quiz: LocalQuiz = {
|
const quiz: LocalQuiz = {
|
||||||
name: "Test Quiz",
|
name: "Test Quiz",
|
||||||
description: "quiz description",
|
description: "quiz description",
|
||||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
lockAt: "21/08/2023 23:59:00",
|
||||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
dueAt: "21/08/2023 23:59:00",
|
||||||
shuffleAnswers: true,
|
shuffleAnswers: true,
|
||||||
oneQuestionAtATime: true,
|
oneQuestionAtATime: true,
|
||||||
password: undefined,
|
password: undefined,
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ this is my description in markdown
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -72,8 +72,8 @@ Name: Test Quiz
|
|||||||
Password: ${password}
|
Password: ${password}
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -93,8 +93,8 @@ Name: Test Quiz
|
|||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
ShowCorrectAnswers: false
|
ShowCorrectAnswers: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -113,8 +113,8 @@ description
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -153,8 +153,8 @@ b) false
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -185,8 +185,8 @@ b) false
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -213,8 +213,8 @@ short_answer`;
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -236,8 +236,8 @@ short answer
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ describe('TextAnswerTests', () => {
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -34,8 +34,8 @@ essay
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -59,8 +59,8 @@ short answer
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
@@ -86,8 +86,8 @@ short_answer`;
|
|||||||
Name: Test Quiz
|
Name: Test Quiz
|
||||||
ShuffleAnswers: true
|
ShuffleAnswers: true
|
||||||
OneQuestionAtATime: false
|
OneQuestionAtATime: false
|
||||||
DueAt: 2023-08-21T23:59:00
|
DueAt: 21/08/2023 23:59:00
|
||||||
LockAt: 2023-08-21T23:59:00
|
LockAt: 21/08/2023 23:59:00
|
||||||
AssignmentGroup: Assignments
|
AssignmentGroup: Assignments
|
||||||
AllowedAttempts: -1
|
AllowedAttempts: -1
|
||||||
Description: this is the
|
Description: this is the
|
||||||
|
|||||||
Reference in New Issue
Block a user