달력 관련 수정

This commit is contained in:
focp212@naver.com
2025-11-07 12:36:58 +09:00
parent 3b4da4f9d4
commit 1fcbc35aab
9 changed files with 40 additions and 21 deletions

View File

@@ -16,6 +16,8 @@ interface NiceCalendarProps {
singleMonth?: string;
calendarType: CalendarType;
setNewMonth: (month: string) => void;
searchPeriod?: number;
periodType?: 'year' | 'month';
};
const NiceCalendarMonth = ({
@@ -25,7 +27,9 @@ const NiceCalendarMonth = ({
endMonth,
singleMonth,
calendarType,
setNewMonth
setNewMonth,
searchPeriod,
periodType
}: NiceCalendarProps) => {
const { i18n } = useTranslation();
const currentLocale = i18n.language || 'en';
@@ -39,11 +43,21 @@ const NiceCalendarMonth = ({
};
const onClickToClose = () => {
// setCalendarOpen(false);
setCalendarOpen(false);
};
const setMinMaxValueDate = () => {
if(calendarType === CalendarType.Start){
setMinMonth(undefined);
if(!searchPeriod){
searchPeriod = 3;
}
if(!periodType){
periodType = 'year';
}
if(periodType && searchPeriod && searchPeriod > 0){
const endDate = moment(endMonth, ['YYYY.MM', 'YYYYMM'], true);
setMinMonth(moment(endDate, 'YYYY.MM.DD').subtract(searchPeriod, periodType).toDate());
}
// setMinMonth(undefined);
if(!!endMonth){
// Parse endMonth with moment, handling both YYYY.MM and YYYYMM formats
const endDate = moment(endMonth, ['YYYY.MM', 'YYYYMM'], true);
@@ -131,7 +145,7 @@ const NiceCalendarMonth = ({
{ (calendarOpen) &&
<>
<div className="bg-dim"></div>
<CalendarWrapper onClick={ () => onClickToClose() }>
<CalendarWrapper className="calendar-container calendar-style">
<FullMenuClose
addClass='filter-calendar-close'
onClickToCallback={ onClickToClose }
@@ -159,11 +173,6 @@ const NiceCalendarMonth = ({
};
const CalendarWrapper = styled.div`
z-index: 1100;
position: absolute;
width: 100%;
height: 100%;
top: 100px;
left: 0;
`;
export default NiceCalendarMonth;