Skip to content

Commit

Permalink
[fixed] allow string names in move()
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Jan 15, 2017
1 parent a25776b commit 45687c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/dates.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-fallthrough: 0 */
/* eslint no-fallthrough: off */
import dateMath from 'date-arithmetic';
import localizer from '../localizer';

Expand Down
9 changes: 7 additions & 2 deletions src/utils/move.js
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 45687c9

Please sign in to comment.