Fix date parsing error in nice-calendar-month
Fixed Invalid date error when selecting year/month:
- Changed date creation from `new Date(moment(endMonth+'01').format('YYYY.MM.DD'))`
to `moment(endMonth + '.01', 'YYYY.MM.DD').toDate()`
- Used proper moment parsing with explicit format string
- Applied to both minMonth and maxMonth date creation
This fixes the error that occurred after localization was applied.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -44,13 +44,13 @@ const NiceCalendarMonth = ({
|
||||
if(calendarType === CalendarType.Start){
|
||||
setMinMonth(undefined);
|
||||
if(!!endMonth){
|
||||
setMaxMonth(new Date(moment(endMonth+'01').format('YYYY.MM.DD')));
|
||||
setMaxMonth(moment(endMonth + '.01', 'YYYY.MM.DD').toDate());
|
||||
}
|
||||
setValueYear(startMonth?.substring(0, 4));
|
||||
}
|
||||
else if(calendarType === CalendarType.End){
|
||||
if(!!startMonth){
|
||||
setMinMonth(new Date(moment(startMonth+'01').format('YYYY.MM.DD')));
|
||||
setMinMonth(moment(startMonth + '.01', 'YYYY.MM.DD').toDate());
|
||||
}
|
||||
setMaxMonth(new Date());
|
||||
setValueYear(endMonth?.substring(0, 4));
|
||||
|
||||
Reference in New Issue
Block a user