Polish #19

Merged
LucidKobold merged 6 commits from polish into main 2021-12-09 16:58:15 -05:00
3 changed files with 208 additions and 314 deletions
Showing only changes of commit 99103a8719 - Show all commits

View File

@@ -43,22 +43,18 @@ const CalenderContextProvider = ({
getDate(endOfMonth(selectedDate)) getDate(endOfMonth(selectedDate))
); );
const [daysOfMonth, setDaysOfMonth] = useState<[number]>([0]); const [daysOfMonth, setDaysOfMonth] = useState<[number]>([1]);
// Update or populate the days of the month. // Update or populate the days of the month.
const populateDays = (): void => { const populateDays = (): void => {
let newDaysOfMonth: [number] = [...daysOfMonth]; let newDaysOfMonth: [number] = [...daysOfMonth];
if (newDaysOfMonth.length > 1) { if (newDaysOfMonth.length > 1) {
newDaysOfMonth = [0]; newDaysOfMonth = [1];
} }
for (let i = 1; i < endOfSelectedMonth; i++) { for (let i = 1; i < endOfSelectedMonth; i++) {
if (newDaysOfMonth[i - 1] === 0) { newDaysOfMonth.push(i + 1);
newDaysOfMonth[i - 1] = i;
} else {
newDaysOfMonth.push(i + 1);
}
} }
setDaysOfMonth(newDaysOfMonth); setDaysOfMonth(newDaysOfMonth);