From 0edd574cf69017d32535b0093486056153eeec00 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Tue, 30 Jan 2018 19:10:27 +0200 Subject: [PATCH] Initialize react-dates in index.js --- src/app.js | 5 +++++ src/components/FieldDateInput/DateInput.js | 5 ----- src/components/FieldDateInput/FieldDateInput.test.js | 5 +++++ src/components/FieldDateRangeInput/DateRangeInput.js | 5 ----- .../FieldDateRangeInput/FieldDateRangeInput.test.js | 5 +++++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/app.js b/src/app.js index 24d81e86..65e3a272 100644 --- a/src/app.js +++ b/src/app.js @@ -1,6 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import ReactDOMServer from 'react-dom/server'; + +// react-dates needs to be initialized before using any react-dates component +// https://github.com/airbnb/react-dates#initialize +// NOTE: Initializing it here will initialize it also for app.test.js +import 'react-dates/initialize'; import Helmet from 'react-helmet'; import { BrowserRouter, StaticRouter } from 'react-router-dom'; import { Provider } from 'react-redux'; diff --git a/src/components/FieldDateInput/DateInput.js b/src/components/FieldDateInput/DateInput.js index 3ec65a75..6d124faa 100644 --- a/src/components/FieldDateInput/DateInput.js +++ b/src/components/FieldDateInput/DateInput.js @@ -6,11 +6,6 @@ */ import React, { Component } from 'react'; import { bool, func, instanceOf, shape, string } from 'prop-types'; - -// react-dates needs to be initialized before using any react-dates component -// Since this is currently only component using react-dates we can do it here -// https://github.com/airbnb/react-dates#initialize -import 'react-dates/initialize'; import { SingleDatePicker, isInclusivelyAfterDay, isInclusivelyBeforeDay } from 'react-dates'; import { intlShape, injectIntl } from 'react-intl'; import classNames from 'classnames'; diff --git a/src/components/FieldDateInput/FieldDateInput.test.js b/src/components/FieldDateInput/FieldDateInput.test.js index 3887ea8a..cb4ee8a0 100644 --- a/src/components/FieldDateInput/FieldDateInput.test.js +++ b/src/components/FieldDateInput/FieldDateInput.test.js @@ -1,4 +1,9 @@ import React from 'react'; + +// react-dates needs to be initialized before using any react-dates component +// Since this is currently only component using react-dates we can do it here +// https://github.com/airbnb/react-dates#initialize +import 'react-dates/initialize'; import { renderDeep } from '../../util/test-helpers'; import { DateInput } from './FieldDateInput'; diff --git a/src/components/FieldDateRangeInput/DateRangeInput.js b/src/components/FieldDateRangeInput/DateRangeInput.js index b4621ebf..4edc5ce6 100644 --- a/src/components/FieldDateRangeInput/DateRangeInput.js +++ b/src/components/FieldDateRangeInput/DateRangeInput.js @@ -6,11 +6,6 @@ */ import React, { Component } from 'react'; import { bool, func, instanceOf, oneOf, shape, string } from 'prop-types'; - -// react-dates needs to be initialized before using any react-dates component -// Since this is currently only component using react-dates we can do it here -// https://github.com/airbnb/react-dates#initialize -import 'react-dates/initialize'; import { DateRangePicker, isInclusivelyAfterDay, isInclusivelyBeforeDay } from 'react-dates'; import { intlShape, injectIntl } from 'react-intl'; import classNames from 'classnames'; diff --git a/src/components/FieldDateRangeInput/FieldDateRangeInput.test.js b/src/components/FieldDateRangeInput/FieldDateRangeInput.test.js index dc804b4d..c63903f4 100644 --- a/src/components/FieldDateRangeInput/FieldDateRangeInput.test.js +++ b/src/components/FieldDateRangeInput/FieldDateRangeInput.test.js @@ -1,4 +1,9 @@ import React from 'react'; + +// react-dates needs to be initialized before using any react-dates component +// Since this is currently only component using react-dates we can do it here +// https://github.com/airbnb/react-dates#initialize +import 'react-dates/initialize'; import { renderDeep } from '../../util/test-helpers'; import { LINE_ITEM_NIGHT } from '../../util/types'; import { DateRangeInput } from './FieldDateRangeInput';