@@ -42,6 +42,7 @@ function defaultAxisOptions<TDatum>(
4242 outerSeriesBandPadding : options . outerSeriesBandPadding ?? 0 ,
4343 show : options . show ?? true ,
4444 stacked : options . stacked ?? false ,
45+ shouldNice : options . shouldNice ?? true ,
4546 }
4647}
4748
@@ -119,24 +120,25 @@ function buildTimeAxis<TDatum>(
119120 return value
120121 } )
121122
122- let shouldNice = true
123+ let shouldNice = options . shouldNice
123124
124- if ( typeof options . min === 'number' ) {
125+ // see https://stackoverflow.com/a/2831422
126+ if ( Object . prototype . toString . call ( options . min ) === '[object Date]' ) {
125127 minValue = min ( [ options . min , minValue as Date ] )
126128 shouldNice = false
127129 }
128130
129- if ( typeof options . max === 'number ' ) {
131+ if ( Object . prototype . toString . call ( options . max ) === '[object Date] ' ) {
130132 maxValue = max ( [ options . max , maxValue as Date ] )
131133 shouldNice = false
132134 }
133135
134- if ( typeof options . hardMin === 'number ' ) {
136+ if ( Object . prototype . toString . call ( options . hardMin ) === '[object Date] ' ) {
135137 minValue = options . hardMin
136138 shouldNice = false
137139 }
138140
139- if ( typeof options . hardMax === 'number ' ) {
141+ if ( Object . prototype . toString . call ( options . hardMax ) === '[object Date] ' ) {
140142 maxValue = options . hardMax
141143 shouldNice = false
142144 }
@@ -250,7 +252,7 @@ function buildLinearAxis<TDatum>(
250252 return value
251253 } )
252254
253- let shouldNice = true
255+ let shouldNice = options . shouldNice
254256
255257 if ( typeof options . min === 'number' ) {
256258 minValue = min ( [ options . min , minValue as number ] )
0 commit comments