Skip to content

Current Time Indicator and short Events are offset by step-size number of minutes #1396

@stianeikeland

Description

@stianeikeland

Do you want to request a feature or report a bug?

Bug / Regression caused by #1204

What's the current behavior?

https://codesandbox.io/s/react-big-calendar-example-feofz

  1. Scroll down to current time.
  2. Notice that the current time indicator is off by 15 minutes (one step size)

See related issue with events here: https://codesandbox.io/s/react-big-calendar-example-e1o2n
Events shorter than step-size minutes are offset.

What's the expected behavior?

The current time indicator should be at current time.

Likely cause

https://github.com/intljusticemission/react-big-calendar/blob/7619e592a6e880860c7fc2e9cbc6473ede386955/src/utils/TimeSlots.js#L135-L138

image

When calculating the time line position we hit the top branch of this ternary if. The timeslot step (ex: 15) is subtracted from the number of minutes since calendar min.

A calendar starting at 00:00, ending at 23:59, with current time 14:00 has rangeStart/End 14*60=840. We should be at 58,33% of the day, but (840-15)/(15*96)*100=57,29. 15 minutes..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions