Skip to content

Commit

Permalink
fix: warning defaultProps in Agenda (jquense#2620)
Browse files Browse the repository at this point in the history
Signed-off-by: Mychael Go <admin@mychaelgo.com>
  • Loading branch information
mychaelgo committed Jul 12, 2024
1 parent 7d9d1c5 commit d1c31c2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -217,19 +218,15 @@ 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 }
}

Agenda.navigate = (
date,
action,
{ length = Agenda.defaultProps.length, localizer }
{ length = DEFAULT_LENGTH, localizer }
) => {
switch (action) {
case navigate.PREVIOUS:
Expand All @@ -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')
}
Expand Down

0 comments on commit d1c31c2

Please sign in to comment.