@@ -17,6 +17,7 @@ import { SchedulerProcessedDate, TemporalSupportedObject } from '@mui/x-schedule
1717import { MiniCalendarProps } from './MiniCalendar.types' ;
1818import { useTranslations } from '../../internals/utils/TranslationsContext' ;
1919import { useEventCalendarClasses } from '../EventCalendarClassesContext' ;
20+ import { formatMonthFullLetterAndYear } from '../../internals/utils/date-utils' ;
2021
2122const MiniCalendarRoot = styled ( 'div' , {
2223 name : 'MuiEventCalendar' ,
@@ -187,26 +188,7 @@ export const MiniCalendar = React.forwardRef<HTMLDivElement, MiniCalendarProps>(
187188 // Get weekday headers from first week
188189 const weekdays = weeks [ 0 ] ?? [ ] ;
189190
190- const handlePreviousMonth = React . useCallback ( ( ) => {
191- setDisplayedMonth ( ( prev ) => adapter . addMonths ( prev , - 1 ) ) ;
192- } , [ adapter ] ) ;
193-
194- const handleNextMonth = React . useCallback ( ( ) => {
195- setDisplayedMonth ( ( prev ) => adapter . addMonths ( prev , 1 ) ) ;
196- } , [ adapter ] ) ;
197-
198- const handleDayClick = React . useCallback (
199- ( day : TemporalSupportedObject , event : React . MouseEvent ) => {
200- store . goToDate ( day , event ) ;
201- } ,
202- [ store ] ,
203- ) ;
204-
205- // Format month and year label (e.g., "May 2025")
206- const monthYearLabel = React . useMemo ( ( ) => {
207- const f = adapter . formats ;
208- return adapter . formatByString ( displayedMonth , `${ f . monthFullLetter } ${ f . yearPadded } ` ) ;
209- } , [ adapter , displayedMonth ] ) ;
191+ const monthYearLabel = React . useMemo ( ( ) => formatMonthFullLetterAndYear ( displayedMonth , adapter ) , [ adapter , displayedMonth ] ) ;
210192
211193 return (
212194 < MiniCalendarRoot
@@ -224,14 +206,14 @@ export const MiniCalendar = React.forwardRef<HTMLDivElement, MiniCalendarProps>(
224206 < IconButton
225207 size = "small"
226208 aria-label = { translations . miniCalendarGoToPreviousMonth }
227- onClick = { handlePreviousMonth }
209+ onClick = { ( ) => setDisplayedMonth ( ( prev ) => adapter . addMonths ( prev , - 1 ) ) }
228210 >
229211 < ChevronLeftIcon fontSize = "small" />
230212 </ IconButton >
231213 < IconButton
232214 size = "small"
233215 aria-label = { translations . miniCalendarGoToNextMonth }
234- onClick = { handleNextMonth }
216+ onClick = { ( ) => setDisplayedMonth ( ( prev ) => adapter . addMonths ( prev , 1 ) ) }
235217 >
236218 < ChevronRightIcon fontSize = "small" />
237219 </ IconButton >
@@ -281,7 +263,7 @@ export const MiniCalendar = React.forwardRef<HTMLDivElement, MiniCalendarProps>(
281263 aria-current = { isToday ? 'date' : undefined }
282264 aria-selected = { isActive }
283265 tabIndex = { isActive ? 0 : - 1 }
284- onClick = { ( event ) => handleDayClick ( day . value , event ) }
266+ onClick = { ( event ) => store . goToDate ( day . value , event ) }
285267 >
286268 { adapter . formatByString ( day . value , adapter . formats . dayOfMonth ) }
287269 </ MiniCalendarDayButton >
0 commit comments