File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -904,15 +904,17 @@ export default class StoreImp implements Store {
904904 }
905905 case 'month' : {
906906 const date = new Date ( referenceTimestamp )
907- const originalDay = date . getDate ( )
908- const targetMonth = date . getMonth ( ) + span * diff
909- date . setMonth ( targetMonth )
907+ const referenceDay = date . getDate ( )
908+
909+ date . setDate ( 1 )
910+
911+ date . setMonth ( date . getMonth ( ) + span * diff )
910912 const lastDayOfTargetMonth = new Date (
911913 date . getFullYear ( ) ,
912914 date . getMonth ( ) + 1 ,
913915 0
914916 ) . getDate ( )
915- date . setDate ( Math . min ( originalDay , lastDayOfTargetMonth ) )
917+ date . setDate ( Math . min ( referenceDay , lastDayOfTargetMonth ) )
916918 return date . getTime ( )
917919 }
918920 case 'year' : {
@@ -971,7 +973,7 @@ export default class StoreImp implements Store {
971973 const currentYear = currentDate . getFullYear ( )
972974 const referenceMonth = referenceDate . getMonth ( )
973975 const currentMonth = currentDate . getMonth ( )
974- return baseDataIndex + Math . floor ( ( currentYear - referenceYear ) * 12 + ( currentMonth - referenceMonth ) / span )
976+ return baseDataIndex + Math . floor ( ( ( currentYear - referenceYear ) * 12 + ( currentMonth - referenceMonth ) ) / span )
975977 }
976978 case 'year' : {
977979 const referenceYear = new Date ( referenceTimestamp ) . getFullYear ( )
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export default abstract class XAxisImp extends AxisImp implements XAxis {
8585 if ( tickBetweenBarCount % 2 !== 0 ) {
8686 tickBetweenBarCount += 1
8787 }
88- const startDataIndex = Math . floor ( realFrom / tickBetweenBarCount ) * tickBetweenBarCount
88+ const startDataIndex = Math . max ( 0 , Math . floor ( realFrom / tickBetweenBarCount ) * tickBetweenBarCount )
8989
9090 for ( let i = startDataIndex ; i < realTo ; i += tickBetweenBarCount ) {
9191 if ( i >= from ) {
You can’t perform that action at this time.
0 commit comments