File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
- /* eslint no-fallthrough: 0 */
1
+ /* eslint no-fallthrough: off */
2
2
import dateMath from 'date-arithmetic' ;
3
3
import localizer from '../localizer' ;
4
4
Original file line number Diff line number Diff line change
1
+ import invariant from 'invariant' ;
1
2
import { navigate } from './constants' ;
3
+ import VIEWS from '../Views' ;
2
4
3
5
export default function moveDate ( action , date , View ) {
4
- switch ( action ) {
6
+ View = typeof view === 'string' ? VIEWS [ View ] : View ;
7
+
8
+ switch ( action ) {
5
9
case navigate . TODAY :
6
10
date = new Date ( )
7
11
break ;
8
12
case navigate . DATE :
9
13
break ;
10
14
default :
15
+ invariant ( View && typeof View . navigate === 'function' ,
16
+ 'Calendar View components must implement a static `.navigate(date, action)` method.s' )
11
17
date = View . navigate ( date , action )
12
18
}
13
-
14
19
return date
15
20
}
You can’t perform that action at this time.
0 commit comments