diff --git a/src/utils/dates.js b/src/utils/dates.js index 02c996779..7701c2443 100644 --- a/src/utils/dates.js +++ b/src/utils/dates.js @@ -1,4 +1,4 @@ -/* eslint no-fallthrough: 0 */ +/* eslint no-fallthrough: off */ import dateMath from 'date-arithmetic'; import localizer from '../localizer'; diff --git a/src/utils/move.js b/src/utils/move.js index 9c559cad3..09bb13c6c 100644 --- a/src/utils/move.js +++ b/src/utils/move.js @@ -1,15 +1,20 @@ +import invariant from 'invariant'; import { navigate } from './constants'; +import VIEWS from '../Views'; export default function moveDate(action, date, View){ - switch (action){ + View = typeof view === 'string' ? VIEWS[View] : View; + + switch (action) { case navigate.TODAY: date = new Date() break; case navigate.DATE: break; default: + invariant(View && typeof View.navigate === 'function', + 'Calendar View components must implement a static `.navigate(date, action)` method.s') date = View.navigate(date, action) } - return date }