Skip to content

Commit

Permalink
Ensure that changes in min and max time is reflected when computing t…
Browse files Browse the repository at this point in the history
…he Now indicator
  • Loading branch information
aminland committed Apr 29, 2019
1 parent b9fdce4 commit f9bef4b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/DayColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ class DayColumn extends React.Component {
}

componentDidUpdate(prevProps, prevState) {
const getNowChanged = !dates.eq(
prevProps.getNow(),
this.props.getNow(),
'minutes'
)
const shouldUpdateTimeIndicator =
!dates.eq(prevProps.getNow(), this.props.getNow(), 'minutes') ||
!dates.eq(prevProps.max(), this.props.max(), 'minutes') ||
!dates.eq(prevProps.min(), this.props.min(), 'minutes')

if (prevProps.isNow !== this.props.isNow || getNowChanged) {
if (prevProps.isNow !== this.props.isNow || shouldUpdateTimeIndicator) {
this.clearTimeIndicatorInterval()

if (this.props.isNow) {
const tail =
!getNowChanged &&
!shouldUpdateTimeIndicator &&
dates.eq(prevProps.date, this.props.date, 'minutes') &&
prevState.timeIndicatorPosition === this.state.timeIndicatorPosition

Expand Down

0 comments on commit f9bef4b

Please sign in to comment.