@@ -41,7 +41,7 @@ export const Calendar: React.FC<CalendarProps> = ({
4141 const bottomValue = date . getFullYear ( ) ;
4242 bottomValues . push (
4343 < text
44- key = { date . getFullYear ( ) }
44+ key = { date . getTime ( ) }
4545 y = { headerHeight * 0.8 }
4646 x = { columnWidth * i + columnWidth * 0.5 }
4747 className = { styles . calendarBottomText }
@@ -76,6 +76,51 @@ export const Calendar: React.FC<CalendarProps> = ({
7676 return [ topValues , bottomValues ] ;
7777 } ;
7878
79+ const getCalendarValuesForQuarterYear = ( ) => {
80+ const topValues : ReactChild [ ] = [ ] ;
81+ const bottomValues : ReactChild [ ] = [ ] ;
82+ const topDefaultHeight = headerHeight * 0.5 ;
83+ for ( let i = 0 ; i < dateSetup . dates . length ; i ++ ) {
84+ const date = dateSetup . dates [ i ] ;
85+ // const bottomValue = getLocaleMonth(date, locale);
86+ const quarter = "Q" + Math . floor ( ( date . getMonth ( ) + 3 ) / 3 ) ;
87+ bottomValues . push (
88+ < text
89+ key = { date . getTime ( ) }
90+ y = { headerHeight * 0.8 }
91+ x = { columnWidth * i + columnWidth * 0.5 }
92+ className = { styles . calendarBottomText }
93+ >
94+ { quarter }
95+ </ text >
96+ ) ;
97+ if (
98+ i === 0 ||
99+ date . getFullYear ( ) !== dateSetup . dates [ i - 1 ] . getFullYear ( )
100+ ) {
101+ const topValue = date . getFullYear ( ) . toString ( ) ;
102+ let xText : number ;
103+ if ( rtl ) {
104+ xText = ( 6 + i + date . getMonth ( ) + 1 ) * columnWidth ;
105+ } else {
106+ xText = ( 6 + i - date . getMonth ( ) ) * columnWidth ;
107+ }
108+ topValues . push (
109+ < TopPartOfCalendar
110+ key = { topValue }
111+ value = { topValue }
112+ x1Line = { columnWidth * i }
113+ y1Line = { 0 }
114+ y2Line = { topDefaultHeight }
115+ xText = { Math . abs ( xText ) }
116+ yText = { topDefaultHeight * 0.9 }
117+ />
118+ ) ;
119+ }
120+ }
121+ return [ topValues , bottomValues ] ;
122+ } ;
123+
79124 const getCalendarValuesForMonth = ( ) => {
80125 const topValues : ReactChild [ ] = [ ] ;
81126 const bottomValues : ReactChild [ ] = [ ] ;
@@ -315,10 +360,13 @@ export const Calendar: React.FC<CalendarProps> = ({
315360 case ViewMode . Year :
316361 [ topValues , bottomValues ] = getCalendarValuesForYear ( ) ;
317362 break ;
363+ case ViewMode . QuarterYear :
364+ [ topValues , bottomValues ] = getCalendarValuesForQuarterYear ( ) ;
365+ break ;
318366 case ViewMode . Month :
319- [ topValues , bottomValues ] = getCalendarValuesForMonth ( ) ;
320- break ;
321- case ViewMode . Week :
367+ [ topValues , bottomValues ] = getCalendarValuesForMonth ( ) ;
368+ break ;
369+ case ViewMode . Week :
322370 [ topValues , bottomValues ] = getCalendarValuesForWeek ( ) ;
323371 break ;
324372 case ViewMode . Day :
0 commit comments