fixing date formatting to month day year

This commit is contained in:
2024-08-27 19:59:26 -06:00
parent 4e412fd6bf
commit 27349af5b9
21 changed files with 284 additions and 212 deletions

View File

@@ -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",

View File

@@ -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);

View File

@@ -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:

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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:00AM"
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:00AM";
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);
});
});