Skip to content

Commit

Permalink
fix: correct treatment of boolean view in 'views' (jquense#2368)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshmn47 authored Feb 17, 2023
1 parent 6cd3a4b commit 0e6b771
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ import mapValues from 'lodash/mapValues'
import { wrapAccessor } from './utils/accessors'

function viewNames(_views) {
return !Array.isArray(_views) ? Object.keys(_views) : _views
if (Array.isArray(_views)) {
return _views
}
const views = []
for (const [key, value] of Object.entries(_views)) {
if (value) {
views.push(key)
}
}
return views
}

function isValidView(view, { views: _views }) {
Expand All @@ -47,7 +56,7 @@ class Calendar extends React.Component {
* const localizer = globalizeLocalizer(globalize)
* ```
* moment
* ```js
* ``js
* import {momentLocalizer} from 'react-big-calendar'
* import moment from 'moment'
* // and, for optional time zone support
Expand Down

0 comments on commit 0e6b771

Please sign in to comment.