@@ -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
@@ -117,24 +118,25 @@ function buildTimeAxis<TDatum>(
117118 return value
118119 } )
119120
120- let shouldNice = true
121+ let shouldNice = options . shouldNice
121122
122- if ( typeof options . min === 'number' ) {
123+ // see https://stackoverflow.com/a/2831422
124+ if ( Object . prototype . toString . call ( options . min ) === '[object Date]' ) {
123125 minValue = min ( [ options . min , minValue as Date ] )
124126 shouldNice = false
125127 }
126128
127- if ( typeof options . max === 'number ' ) {
129+ if ( Object . prototype . toString . call ( options . max ) === '[object Date] ' ) {
128130 maxValue = max ( [ options . max , maxValue as Date ] )
129131 shouldNice = false
130132 }
131133
132- if ( typeof options . hardMin === 'number ' ) {
134+ if ( Object . prototype . toString . call ( options . hardMin ) === '[object Date] ' ) {
133135 minValue = options . hardMin
134136 shouldNice = false
135137 }
136138
137- if ( typeof options . hardMax === 'number ' ) {
139+ if ( Object . prototype . toString . call ( options . hardMax ) === '[object Date] ' ) {
138140 maxValue = options . hardMax
139141 shouldNice = false
140142 }
@@ -245,7 +247,7 @@ function buildLinearAxis<TDatum>(
245247 return value
246248 } )
247249
248- let shouldNice = true
250+ let shouldNice = options . shouldNice
249251
250252 if ( typeof options . min === 'number' ) {
251253 minValue = min ( [ options . min , minValue as number ] )
0 commit comments