@@ -69,6 +69,8 @@ export default {
6969 return date .toLocaleDateString (' en-US' , { weekday: ' short' });
7070 });
7171 } else if (resolution .startsWith (' month' )) {
72+ // FIXME: Needs access to the timeperiod start to know which month
73+ // How many days are in the given month?
7274 const date = new Date (start );
7375 const daysInMonth = new Date (date .getFullYear (), date .getMonth () + 1 , 0 ).getDate ();
7476 const ordinalsEnUS = {
@@ -83,11 +85,7 @@ export default {
8385 const pluralRules = new Intl .PluralRules (locale , { type: ' ordinal' });
8486 return ` ${num }${ordinals [pluralRules .select (num )]} ` ;
8587 };
86- // FIXME: Needs access to the timeperiod start to know which month
87- // How many days are in the given month?
8888 return _ .range (1 , daysInMonth + 1 ).map (d => toOrdinalSuffix (d ));
89-
90-
9189 } else if (resolution == ' year' ) {
9290 return [' Jan' , ' Feb' , ' Mar' , ' Apr' , ' May' , ' Jun' , ' Jul' , ' Aug' , ' Sep' , ' Oct' , ' Nov' , ' Dec' ];
9391 } else {
@@ -115,12 +113,16 @@ export default {
115113 mode: ' point' ,
116114 intersect: false ,
117115 callbacks: {
118- label : function (context ) {
119- let value = context .parsed .y
120- let hours = Math .floor (value )
121- let minutes = Math .round ((value - hours ) * 60 )
122- let minutes_str = minutes .toString ().padStart (2 , " 0" )
123- return ` ${hours }:${minutes_str } `
116+ label : function (context ) {
117+ let value = context .parsed .y ;
118+ let hours = Math .floor (value );
119+ let minutes = Math .round ((value - hours ) * 60 );
120+ if (minutes == 60 ) {
121+ minutes = 0 ;
122+ hours += 1 ;
123+ }
124+ let minutes_str = minutes .toString ().padStart (2 , " 0" );
125+ return ` ${hours }:${minutes_str } ` ;
124126 }
125127 }
126128 },
0 commit comments