|
1 | 1 | /* eslint-disable func-style */
|
2 | 2 | /* eslint-disable no-use-before-define */
|
3 | 3 | import React from "react";
|
4 |
| -import { flatten, isPlainObject, sortedUniq, isFunction, includes } from "lodash"; |
| 4 | +import { flatten, isPlainObject, sortedUniq, isFunction, includes, isDate } from "lodash"; |
5 | 5 | import Data from "./data";
|
6 | 6 | import Scale from "./scale";
|
7 | 7 | import Helpers from "./helpers";
|
@@ -320,26 +320,30 @@ function getDomainWithZero(props, axis) {
|
320 | 320 | * Returns the maxDomain from props if it exists
|
321 | 321 | * @param {Object} props: the props object
|
322 | 322 | * @param {String} axis: the current axis
|
323 |
| - * @returns {Number|undefined} the maxDomain based on props |
| 323 | + * @returns {Number|Date|undefined} the maxDomain based on props |
324 | 324 | */
|
325 | 325 | function getMaxFromProps(props, axis) {
|
326 | 326 | if (isPlainObject(props.maxDomain) && props.maxDomain[axis] !== undefined) {
|
327 | 327 | return props.maxDomain[axis];
|
328 | 328 | }
|
329 |
| - return typeof props.maxDomain === "number" ? props.maxDomain : undefined; |
| 329 | + return typeof props.maxDomain === "number" || isDate(props.maxDomain) |
| 330 | + ? props.maxDomain |
| 331 | + : undefined; |
330 | 332 | }
|
331 | 333 |
|
332 | 334 | /**
|
333 | 335 | * Returns the minDomain from props if it exists
|
334 | 336 | * @param {Object} props: the props object
|
335 | 337 | * @param {String} axis: the current axis
|
336 |
| - * @returns {Number|undefined} the minDomain based on props |
| 338 | + * @returns {Number|Date|undefined} the minDomain based on props |
337 | 339 | */
|
338 | 340 | function getMinFromProps(props, axis) {
|
339 | 341 | if (isPlainObject(props.minDomain) && props.minDomain[axis] !== undefined) {
|
340 | 342 | return props.minDomain[axis];
|
341 | 343 | }
|
342 |
| - return typeof props.minDomain === "number" ? props.minDomain : undefined; |
| 344 | + return typeof props.minDomain === "number" || isDate(props.minDomain) |
| 345 | + ? props.minDomain |
| 346 | + : undefined; |
343 | 347 | }
|
344 | 348 |
|
345 | 349 | /**
|
|
0 commit comments