diff --git a/src/Agenda.js b/src/Agenda.js index a076bcfff..8eb9f0e9a 100644 --- a/src/Agenda.js +++ b/src/Agenda.js @@ -9,13 +9,14 @@ import { navigate } from './utils/constants' import { inRange } from './utils/eventLevels' import { isSelected } from './utils/selection' +const DEFAULT_LENGTH = 30; function Agenda({ accessors, components, date, events, getters, - length, + length = DEFAULT_LENGTH, localizer, onDoubleClickEvent, onSelectEvent, @@ -217,11 +218,7 @@ Agenda.propTypes = { selected: PropTypes.object, } -Agenda.defaultProps = { - length: 30, -} - -Agenda.range = (start, { length = Agenda.defaultProps.length, localizer }) => { +Agenda.range = (start, { length = DEFAULT_LENGTH, localizer }) => { let end = localizer.add(start, length, 'day') return { start, end } } @@ -229,7 +226,7 @@ Agenda.range = (start, { length = Agenda.defaultProps.length, localizer }) => { Agenda.navigate = ( date, action, - { length = Agenda.defaultProps.length, localizer } + { length = DEFAULT_LENGTH, localizer } ) => { switch (action) { case navigate.PREVIOUS: @@ -243,7 +240,7 @@ Agenda.navigate = ( } } -Agenda.title = (start, { length = Agenda.defaultProps.length, localizer }) => { +Agenda.title = (start, { length = DEFAULT_LENGTH, localizer }) => { let end = localizer.add(start, length, 'day') return localizer.format({ start, end }, 'agendaHeaderFormat') }