달력 관련 수정
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user