Moved valid date range function into it's own file to be accessibly within the dynamic pages.

This commit is contained in:
Lucid Kobold
2022-03-26 00:43:22 -05:00
parent 94ffe42325
commit 5071d5a6ba
5 changed files with 39 additions and 23 deletions

View File

@@ -3,11 +3,14 @@ import { useRouter } from "next/router";
import { HStack, IconButton } from "@chakra-ui/react";
import { Icon } from "@iconify/react";
import { sub, add, format, isSameMonth } from "date-fns";
import findValidDateRange from "../../lib/findValidDateRange"
import DatePicker from "./DatePicker";
import { CalenderContext } from "../../contexts/CalenderContext";
const CalenderNav = (): JSX.Element => {
const { selectedDate, validDateRange } = useContext(CalenderContext);
const { selectedDate } = useContext(CalenderContext);
const validDateRange = findValidDateRange();
const { start: validStart, end: validEnd } = validDateRange;
const router = useRouter();