@@ -42,6 +42,7 @@ function defaultAxisOptions<TDatum>(
42
42
outerSeriesBandPadding : options . outerSeriesBandPadding ?? 0 ,
43
43
show : options . show ?? true ,
44
44
stacked : options . stacked ?? false ,
45
+ shouldNice : options . shouldNice ?? true ,
45
46
}
46
47
}
47
48
@@ -117,24 +118,25 @@ function buildTimeAxis<TDatum>(
117
118
return value
118
119
} )
119
120
120
- let shouldNice = true
121
+ let shouldNice = options . shouldNice
121
122
122
- if ( typeof options . min === 'number' ) {
123
+ // see https://stackoverflow.com/a/2831422
124
+ if ( Object . prototype . toString . call ( options . min ) === '[object Date]' ) {
123
125
minValue = min ( [ options . min , minValue as Date ] )
124
126
shouldNice = false
125
127
}
126
128
127
- if ( typeof options . max === 'number ' ) {
129
+ if ( Object . prototype . toString . call ( options . max ) === '[object Date] ' ) {
128
130
maxValue = max ( [ options . max , maxValue as Date ] )
129
131
shouldNice = false
130
132
}
131
133
132
- if ( typeof options . hardMin === 'number ' ) {
134
+ if ( Object . prototype . toString . call ( options . hardMin ) === '[object Date] ' ) {
133
135
minValue = options . hardMin
134
136
shouldNice = false
135
137
}
136
138
137
- if ( typeof options . hardMax === 'number ' ) {
139
+ if ( Object . prototype . toString . call ( options . hardMax ) === '[object Date] ' ) {
138
140
maxValue = options . hardMax
139
141
shouldNice = false
140
142
}
@@ -245,7 +247,7 @@ function buildLinearAxis<TDatum>(
245
247
return value
246
248
} )
247
249
248
- let shouldNice = true
250
+ let shouldNice = options . shouldNice
249
251
250
252
if ( typeof options . min === 'number' ) {
251
253
minValue = min ( [ options . min , minValue as number ] )
0 commit comments