Skip to content

Commit

Permalink
Merge pull request #447 from LikeLion-at-DGU/dev
Browse files Browse the repository at this point in the history
🚀 Deploy
  • Loading branch information
sayyyho authored Aug 6, 2024
2 parents 032fc37 + 51b397e commit 01abb42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/DateRangeCalendar/DateRangeCalendar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, forwardRef, useImperativeHandle } from "react";
import React, { useState, forwardRef, useMemo } from "react";
import * as S from "./styled";
import {
routineStart,
Expand Down Expand Up @@ -46,7 +46,7 @@ const DateRangeCalendar = forwardRef((ref) => {
}
};

const renderDays = () => {
const renderDays = useMemo(() => {
const days = [];
const startOfMonth = new Date(
currentDate.getFullYear(),
Expand Down Expand Up @@ -96,7 +96,7 @@ const DateRangeCalendar = forwardRef((ref) => {
}

return days;
};
}, [currentDate, selectedStartDate, selectedEndDate]);

const handleMonthChange = (direction) => {
const newDate = new Date(currentDate);
Expand All @@ -112,7 +112,7 @@ const DateRangeCalendar = forwardRef((ref) => {
const formattedEndDate = format(selectedEndDate, "yyyy-MM-dd", {
timeZone,
});
console.log("formatted날짜까지 들어옴");

try {
const response = await postRoutineRegister(
formattedStartDate,
Expand All @@ -129,7 +129,7 @@ const DateRangeCalendar = forwardRef((ref) => {
if (window.location.href.includes("theme")) {
window.location.reload();
}
}, 2000); //
}, 2000);
} else {
console.error("Failed to register routine:", response.statusText);
}
Expand Down Expand Up @@ -166,7 +166,7 @@ const DateRangeCalendar = forwardRef((ref) => {
<S.DayName></S.DayName>
<S.DayName></S.DayName>
<S.DayName style={{ color: "#78A1B5" }}></S.DayName>
{renderDays()}
{renderDays}
</S.CalendarBody>
<S.ConfirmButton onClick={handleConfirm}>확인</S.ConfirmButton>
</S.CalendarContainer>
Expand Down

0 comments on commit 01abb42

Please sign in to comment.