mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
working on hot reloading
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { CalendarMonthModel } from "./calendarMonthUtils";
|
||||
import { DayOfWeek, LocalCourse } from "@/models/local/localCourse";
|
||||
import Day from "./Day";
|
||||
import Day from "./day";
|
||||
|
||||
export default function CalendarMonth({
|
||||
month,
|
||||
@@ -5,7 +5,7 @@ export interface CalendarMonthModel {
|
||||
daysByWeek: (Date | undefined)[][];
|
||||
}
|
||||
|
||||
const weeksInMonth = (year: number, month: number): number => {
|
||||
function weeksInMonth(year: number, month: number): number {
|
||||
const firstDayOfMonth = new Date(year, month - 1, 1).getDay();
|
||||
const daysInMonth = new Date(year, month, 0).getDate();
|
||||
const longDaysInMonth = daysInMonth + firstDayOfMonth;
|
||||
@@ -14,12 +14,9 @@ const weeksInMonth = (year: number, month: number): number => {
|
||||
weeks += 1;
|
||||
}
|
||||
return weeks;
|
||||
};
|
||||
}
|
||||
|
||||
const createCalendarMonth = (
|
||||
year: number,
|
||||
month: number
|
||||
): CalendarMonthModel => {
|
||||
function createCalendarMonth(year: number, month: number): CalendarMonthModel {
|
||||
const daysByWeek: (Date | undefined)[][] = [];
|
||||
const weeksNumber = weeksInMonth(year, month);
|
||||
const daysInMonth = new Date(year, month, 0).getDate();
|
||||
@@ -57,12 +54,12 @@ const createCalendarMonth = (
|
||||
);
|
||||
|
||||
return { year, month, weeks, daysByWeek };
|
||||
};
|
||||
}
|
||||
|
||||
export const getMonthsBetweenDates = (
|
||||
export function getMonthsBetweenDates(
|
||||
startDate: Date,
|
||||
endDate: Date
|
||||
): CalendarMonthModel[] => {
|
||||
): CalendarMonthModel[] {
|
||||
const monthsInTerm =
|
||||
1 +
|
||||
(endDate.getFullYear() - startDate.getFullYear()) * 12 +
|
||||
@@ -76,4 +73,4 @@ export const getMonthsBetweenDates = (
|
||||
Math.floor((startDate.getMonth() + monthDiff) / 12);
|
||||
return createCalendarMonth(year, month);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useLocalCourseDetailsQuery } from "@/hooks/localCoursesHooks";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { getMonthsBetweenDates } from "./calendarMonthUtils";
|
||||
import CalendarMonth from "./CalendarMonth";
|
||||
import CalendarMonth from "./calendarMonth";
|
||||
|
||||
|
||||
export default function Page({
|
||||
|
||||
Reference in New Issue
Block a user