coronasafe/care_fe

View on GitHub
src/CAREUI/interactive/Calendar.tsx

Summary

Maintainability
B
5 hrs
Test Coverage

Showing 3 of 3 total issues

Function Calendar has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function Calendar(props: Props) {
const currentMonth = props.month ?? new Date();
const highlightToday = props.highlightToday ?? true;
const currentMonthRange = getMonthStartAndEnd(currentMonth);
 
 
Severity: Major
Found in src/CAREUI/interactive/Calendar.tsx - About 3 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const handleNextMonth = () => {
const nextMonth = new Date(
currentMonth.getFullYear(),
currentMonth.getMonth() + 1,
);
Severity: Minor
Found in src/CAREUI/interactive/Calendar.tsx and 1 other location - About 55 mins to fix
src/CAREUI/interactive/Calendar.tsx on lines 40..46

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const handlePrevMonth = () => {
const prevMonth = new Date(
currentMonth.getFullYear(),
currentMonth.getMonth() - 1,
);
Severity: Minor
Found in src/CAREUI/interactive/Calendar.tsx and 1 other location - About 55 mins to fix
src/CAREUI/interactive/Calendar.tsx on lines 48..54
Category
Status