@@ -71,21 +71,22 @@ export class BookingCalendarComponent implements OnInit, AfterViewInit {
7171 plugins : [ luxon2Plugin , timeGridPlugin ] ,
7272 initialView : 'timeGridWeek' ,
7373 firstDay : 1 ,
74- locale : this . translate . currentLang ,
74+ locale : this . resolveCalendarLocale ( this . translate . currentLang ) ,
7575 locales : [ fiLocale , svLocale , enLocale ] ,
7676 ...this . getFormatOverrides ( this . translate . currentLang ) ,
7777 allDaySlot : false ,
7878 height : 'auto' ,
7979 nowIndicator : true ,
8080 slotLabelFormat : { hour : 'numeric' , minute : '2-digit' , hour12 : false } ,
81+ eventTimeFormat : { hour : '2-digit' , minute : '2-digit' , hour12 : false } ,
8182 eventMinHeight : 45 ,
8283 events : this . refetch ,
8384 eventClick : this . eventClicked . bind ( this ) ,
8485 } ) ;
8586 this . translate . onLangChange . subscribe ( ( event ) => {
8687 this . calendarOptions . set ( {
8788 ...this . calendarOptions ( ) ,
88- locale : event . lang ,
89+ locale : this . resolveCalendarLocale ( event . lang ) ,
8990 ...this . getFormatOverrides ( event . lang ) ,
9091 } ) ;
9192 } ) ;
@@ -183,7 +184,35 @@ export class BookingCalendarComponent implements OnInit, AfterViewInit {
183184 return `${ start . getDate ( ) } .${ start . getMonth ( ) + 1 } . – ${ end . getDate ( ) } .${ end . getMonth ( ) + 1 } .${ end . getFullYear ( ) } ` ;
184185 }
185186 }
186- : { year : 'numeric' as const , month : 'short' as const , day : 'numeric' as const } ,
187+ : // English title format
188+ lang === 'en'
189+ ? ( info : { start : { marker : Date } ; end ?: { marker : Date } } ) => {
190+ const start = new Date ( info . start . marker ) ;
191+ if ( ! info . end ) {
192+ return `${ start . getDate ( ) } ${ start . toLocaleString ( 'en-GB' , { month : 'short' } ) } ${ start . getFullYear ( ) } ` ;
193+ }
194+ const end = new Date ( info . end . marker ) ;
195+ end . setDate ( end . getDate ( ) - 1 ) ;
196+
197+ const sameMonth =
198+ start . getMonth ( ) === end . getMonth ( ) && start . getFullYear ( ) === end . getFullYear ( ) ;
199+ const sameYear = start . getFullYear ( ) === end . getFullYear ( ) ;
200+
201+ if ( sameMonth ) {
202+ return `${ start . getDate ( ) } - ${ end . getDate ( ) } ${ end . toLocaleString ( 'en-GB' , { month : 'short' } ) } ${ end . getFullYear ( ) } ` ;
203+ }
204+ if ( sameYear ) {
205+ const sm = start . toLocaleString ( 'en-GB' , { month : 'short' } ) ;
206+ const em = end . toLocaleString ( 'en-GB' , { month : 'short' } ) ;
207+ return `${ start . getDate ( ) } ${ sm } - ${ end . getDate ( ) } ${ em } ${ end . getFullYear ( ) } ` ;
208+ }
209+ const sm = start . toLocaleString ( 'en-GB' , { month : 'short' } ) ;
210+ const em = end . toLocaleString ( 'en-GB' , { month : 'short' } ) ;
211+ return `${ start . getDate ( ) } ${ sm } ${ start . getFullYear ( ) } - ${ end . getDate ( ) } ${ em } ${ end . getFullYear ( ) } ` ;
212+ }
213+ : { year : 'numeric' as const , month : 'short' as const , day : 'numeric' as const } ,
187214 } ;
188215 }
216+ // Fix for FullCalendar locale
217+ private resolveCalendarLocale = ( lang : string ) => ( lang === 'en' ? 'en-gb' : lang ) ;
189218}
0 commit comments