mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 15:48:32 -06:00
fixing date formatting to month day year
This commit is contained in:
@@ -6,8 +6,8 @@ import { assignmentMarkdownSerializer } from "./utils/assignmentMarkdownSerializ
|
||||
export interface LocalAssignment {
|
||||
name: string;
|
||||
description: string;
|
||||
lockAt?: string; // 21/08/2023 23:59:00
|
||||
dueAt: string; // 21/08/2023 23:59:00
|
||||
lockAt?: string; // 08/21/2023 23:59:00
|
||||
dueAt: string; // 08/21/2023 23:59:00
|
||||
localAssignmentGroupName?: string;
|
||||
submissionTypes: AssignmentSubmissionType[];
|
||||
allowedFileUploadExtensions: string[];
|
||||
|
||||
@@ -9,8 +9,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "here is the description",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: undefined,
|
||||
submissionTypes: [],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
@@ -98,8 +98,8 @@ describe("AssignmentMarkdownTests", () => {
|
||||
const assignment: LocalAssignment = {
|
||||
name: "test assignment",
|
||||
description: "",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
submissionTypes: [AssignmentSubmissionType.ONLINE_UPLOAD],
|
||||
allowedFileUploadExtensions: ["pdf", "txt"],
|
||||
localAssignmentGroupName: "Final Project",
|
||||
|
||||
@@ -6,7 +6,7 @@ describe("PageMarkdownTests", () => {
|
||||
const page: LocalCoursePage = {
|
||||
name: "test title",
|
||||
text: "test text content",
|
||||
dueAt: "09/07/2024 23:59:00",
|
||||
dueAt: "07/09/2024 23:59:00",
|
||||
};
|
||||
|
||||
const pageMarkdownString = localPageMarkdownUtils.toMarkdown(page);
|
||||
|
||||
@@ -9,8 +9,8 @@ describe("MatchingTests", () => {
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description:
|
||||
@@ -37,8 +37,8 @@ Match the following terms & definitions
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description:
|
||||
@@ -69,8 +69,8 @@ Match the following terms & definitions
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description:
|
||||
@@ -89,8 +89,8 @@ Match the following terms & definitions
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description:
|
||||
@@ -112,8 +112,8 @@ Match the following terms & definitions
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description:
|
||||
|
||||
@@ -9,8 +9,8 @@ describe("MultipleAnswersTests", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "desc",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: false,
|
||||
showCorrectAnswers: false,
|
||||
@@ -45,8 +45,8 @@ oneline question
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
|
||||
@@ -10,8 +10,8 @@ describe("MultipleChoiceTests", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "desc",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: false,
|
||||
showCorrectAnswers: false,
|
||||
|
||||
@@ -9,8 +9,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/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: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -77,8 +77,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -105,8 +105,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
localAssignmentGroupName: "Assignments",
|
||||
@@ -136,8 +136,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/2023 23:59:00",
|
||||
shuffleAnswers: true,
|
||||
oneQuestionAtATime: true,
|
||||
password: undefined,
|
||||
@@ -168,8 +168,8 @@ describe("QuizDeterministicChecks", () => {
|
||||
const quiz: LocalQuiz = {
|
||||
name: "Test Quiz",
|
||||
description: "quiz description",
|
||||
lockAt: "21/08/2023 23:59:00",
|
||||
dueAt: "21/08/2023 23:59:00",
|
||||
lockAt: "08/21/2023 23:59:00",
|
||||
dueAt: "08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/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: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
@@ -87,8 +87,8 @@ short_answer`;
|
||||
Name: Test Quiz
|
||||
ShuffleAnswers: true
|
||||
OneQuestionAtATime: false
|
||||
DueAt: 21/08/2023 23:59:00
|
||||
LockAt: 21/08/2023 23:59:00
|
||||
DueAt: 08/21/2023 23:59:00
|
||||
LockAt: 08/21/2023 23:59:00
|
||||
AssignmentGroup: Assignments
|
||||
AllowedAttempts: -1
|
||||
Description: this is the
|
||||
|
||||
@@ -1,23 +1,31 @@
|
||||
|
||||
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { getDateFromString } from "../timeUtils";
|
||||
|
||||
describe("Can properly handle expected date formats", () => {
|
||||
it("can use AM/PM dates", () =>{
|
||||
const dateString = "8/27/2024 1:00:00 AM"
|
||||
const dateObject = getDateFromString(dateString)
|
||||
expect(dateObject).not.toBeUndefined()
|
||||
})
|
||||
it("can use 24 hour dates", () =>{
|
||||
const dateString = "8/27/2024 23:95:00"
|
||||
const dateObject = getDateFromString(dateString)
|
||||
expect(dateObject).not.toBeUndefined()
|
||||
})
|
||||
it("can use ISO format", () =>{
|
||||
const dateString = "2024-08-26T00:00:00.0000000"
|
||||
const dateObject = getDateFromString(dateString)
|
||||
expect(dateObject).not.toBeUndefined()
|
||||
})
|
||||
})
|
||||
it("can use AM/PM dates", () => {
|
||||
const dateString = "8/27/2024 1:00:00 AM";
|
||||
const dateObject = getDateFromString(dateString);
|
||||
expect(dateObject).not.toBeUndefined();
|
||||
});
|
||||
it("can use 24 hour dates", () => {
|
||||
const dateString = "8/27/2024 23:95:00";
|
||||
const dateObject = getDateFromString(dateString);
|
||||
expect(dateObject).not.toBeUndefined();
|
||||
});
|
||||
it("can use ISO format", () => {
|
||||
const dateString = "2024-08-26T00:00:00.0000000";
|
||||
const dateObject = getDateFromString(dateString);
|
||||
expect(dateObject).not.toBeUndefined();
|
||||
});
|
||||
it("can get correct time from format", () => {
|
||||
const dateString = "08/28/2024 23:59:00";
|
||||
const dateObject = getDateFromString(dateString);
|
||||
|
||||
expect(dateObject?.getDate()).toBe(28);
|
||||
expect(dateObject?.getMonth()).toBe(8 - 1); // 0 based
|
||||
expect(dateObject?.getFullYear()).toBe(2024);
|
||||
expect(dateObject?.getMinutes()).toBe(59);
|
||||
expect(dateObject?.getHours()).toBe(23);
|
||||
expect(dateObject?.getSeconds()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ const _getDateFromMilitary = (
|
||||
datePart: string,
|
||||
timePart: string
|
||||
): Date | undefined => {
|
||||
const [day, month, year] = datePart.split("/").map(Number);
|
||||
const [month, day, year] = datePart.split("/").map(Number);
|
||||
const [hours, minutes, seconds] = timePart.split(":").map(Number);
|
||||
|
||||
const date = new Date(year, month - 1, day, hours, minutes, seconds);
|
||||
@@ -86,5 +86,5 @@ export const dateToMarkdownString = (date: Date) => {
|
||||
const stringMinutes = String(date.getMinutes()).padStart(2, "0");
|
||||
const stringSeconds = String(date.getSeconds()).padStart(2, "0");
|
||||
|
||||
return `${stringDay}/${stringMonth}/${stringYear} ${stringHours}:${stringMinutes}:${stringSeconds}`;
|
||||
return `${stringMonth}/${stringDay}/${stringYear} ${stringHours}:${stringMinutes}:${stringSeconds}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user