forked from jquense/react-big-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] expose
move
and label
methods for easier external toolbars
- Loading branch information
Showing
5 changed files
with
65 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { views } from './utils/constants'; | ||
import Month from './Month'; | ||
import Day from './Day'; | ||
import Week from './Week'; | ||
import Agenda from './Agenda'; | ||
|
||
const VIEWS = { | ||
[views.MONTH]: Month, | ||
[views.WEEK]: Week, | ||
[views.DAY]: Day, | ||
[views.AGENDA]: Agenda | ||
}; | ||
|
||
export default VIEWS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { navigate } from './constants'; | ||
import VIEWS from '../Views'; | ||
|
||
export default function moveDate(action, date, view){ | ||
switch (action){ | ||
case navigate.TODAY: | ||
date = new Date() | ||
break; | ||
case navigate.DATE: | ||
break; | ||
default: | ||
date = VIEWS[view].navigate(date, action) | ||
} | ||
|
||
return date | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { views } from './constants'; | ||
import defaultFormats from '../formats'; | ||
import localizer from '../localizer'; | ||
|
||
import VIEWS from '../Views'; | ||
|
||
const Formats = { | ||
[views.MONTH]: 'monthHeaderFormat', | ||
[views.WEEK]: 'dayRangeHeaderFormat', | ||
[views.DAY]: 'dayHeaderFormat', | ||
[views.AGENDA]: 'agendaHeaderFormat' | ||
} | ||
|
||
export default function viewLabel(date, view, formats, culture){ | ||
let View = VIEWS[view]; | ||
let headerSingle = view === views.MONTH || view === views.DAY | ||
|
||
formats = defaultFormats(formats || {}) | ||
|
||
let headerFormat = formats[Formats[view]]; | ||
|
||
return headerSingle | ||
? localizer.format(date, headerFormat, culture) | ||
: localizer.format(View.range(date, { culture }), headerFormat, culture) | ||
} |