mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28: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())) {
|
||||
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 => {
|
||||
|
||||
@@ -9,8 +9,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "here is the description",
|
||||
dueAt: new Date().toISOString(),
|
||||
lockAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
rubric: [
|
||||
@@ -32,8 +32,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "here is the description",
|
||||
dueAt: new Date().toISOString(),
|
||||
lockAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
rubric: [],
|
||||
@@ -52,8 +52,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "here is the description",
|
||||
dueAt: new Date().toISOString(),
|
||||
lockAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
submissionTypes: [],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
rubric: [
|
||||
@@ -75,7 +75,7 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "here is the description",
|
||||
dueAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: undefined,
|
||||
submissionTypes: [],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
@@ -98,8 +98,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "",
|
||||
dueAt: new Date().toISOString(),
|
||||
lockAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
submissionTypes: [],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
rubric: [
|
||||
@@ -121,8 +121,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "test assignment\n---\nsomestuff",
|
||||
dueAt: new Date().toISOString(),
|
||||
lockAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
submissionTypes: [],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
rubric: [],
|
||||
@@ -141,8 +141,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "here is the description",
|
||||
dueAt: new Date().toISOString(),
|
||||
lockAt: new Date().toISOString(),
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||
allowedFileUploadExtensions: ["pdf", "txt"],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
|
||||
@@ -9,8 +9,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -29,8 +29,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
showCorrectAnswers: false,
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
@@ -49,8 +49,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -76,8 +76,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -103,8 +103,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -133,8 +133,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
password: undefined,
|
||||
@@ -164,8 +164,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
dueAt: new Date(2022, 9, 3, 12, 5, 0).toISOString(),
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
password: undefined,
|
||||
|
||||
@@ -41,8 +41,8 @@ this is my description in markdown
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -72,8 +72,8 @@ Name: Test Quiz
|
||||
Password: ${password}
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -93,8 +93,8 @@ Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
ShowCorrectAnswers: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -113,8 +113,8 @@ description
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -153,8 +153,8 @@ b) false
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -185,8 +185,8 @@ b) false
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -213,8 +213,8 @@ short_answer`;
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -236,8 +236,8 @@ short answer
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
|
||||
@@ -9,8 +9,8 @@ describe('TextAnswerTests', () => {
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -34,8 +34,8 @@ essay
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -59,8 +59,8 @@ short answer
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -86,8 +86,8 @@ short_answer`;
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 2023-08-21T23:59:00
|
||||
LockAt: 2023-08-21T23:59:00
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
|
||||
Reference in New Issue
Block a user