Moved valid date range function into it's own file to be accessibly within the dynamic pages.
This commit is contained in:
@@ -206,19 +206,6 @@ const CalenderContextProvider = ({
|
||||
setSelectedMonthInfo(output);
|
||||
};
|
||||
|
||||
const setValidDateRange = (): ValidDateRange => {
|
||||
const currDate = new Date(); // Current date.
|
||||
const startDate = startOfMonth(currDate); // Will eventually be the creation date of the account or the creation date of the oldest chart within the account. Whichever is older.
|
||||
const endDate = endOfMonth(currDate); // Always needs to be the last day on the current month within the current year.
|
||||
|
||||
return {
|
||||
start: startDate,
|
||||
end: endDate
|
||||
};
|
||||
};
|
||||
|
||||
const [validDateRange] = useState<ValidDateRange>(setValidDateRange());
|
||||
|
||||
// TODO: Add a function that validated if a date has at least one sticker in it. Use that within the nav function (when filter is enabled).
|
||||
|
||||
// TODO: Add a function that will give the closest date, if available, when the nav func detects an empty month.
|
||||
@@ -257,7 +244,6 @@ const CalenderContextProvider = ({
|
||||
selectedDate,
|
||||
title: selectedDateInfo.title,
|
||||
layout: selectedDateInfo.layout,
|
||||
validDateRange,
|
||||
updateDate
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user