question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Snap events to timeslots on resize

See original GitHub issue

Checklist

Please mark these items with an [x]

  • I’ve already searched through existing tickets
  • Other people will find this feature useful

Feature Description

Events are extended by mutiples of slotDuration so they cannot be resized to the end of a timeslot unless they did initially. Eg. Event ends at 8:35 so it can be resized to end at 9:05 but not 9:00.

https://codepen.io/freexd/pen/BazGNwE

The request is to “snap” event resizing to the timeslots which was the behaviour in v2:

https://codepen.io/freexd/pen/LYZXPVL

Requested in https://fullcalendar.freshdesk.com/a/tickets/2332

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:15
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
minhhdlcommented, Oct 18, 2021

Any update on this? The snapping behavior in V2 is really good but why it disappears in current version. so sad 😦(

0reactions
yannkostcommented, Apr 8, 2022

I was able to make a workaround for the final result in eventResize, this however is NOT REFLECTED during resize. Is there a possiblitiy to update the event during resize? Would be great.

Still, and option would be more than appreciated. (We took a licence but where surprised that we can’t ‘snap’ to exact hours as our events where initialized with times not corresponding to the snapDuration as they where initialized with the current Timestamp in the database. )

Something like: ‘snapToSnapDuration’: boolean would be great. (Can be false as default, as long that we can decide. The options to NOT snap to a Duration can also be a desired behaviour.)

For the workaround:

eventResize: function (info) {

  let event = info.event
  if(roundToNextTimeSlot){
                          if (info.endDelta.years !== 0 || info.endDelta.months !== 0 || info.endDelta.days !== 0 || info.endDelta.milliseconds !== 0) {
                             
                              let value = setToRoundedTimeInterval(event.end)
                              event.setEnd(new Date(value.substring(0, value.length - 1)))
                              console.log('new EndDate', value)
                          }
  
                          if (info.startDelta.years !== 0 || info.startDelta.months !== 0 || info.startDelta.days !== 0 || info.startDelta.milliseconds !== 0) {
                              
                              let value = setToRoundedTimeInterval(event.start)
                              event.setStart(new Date(value.substring(0, value.length - 1)))
                              console.log('new StartDate', value)
                          }
                      }
}

Here setToRoundedTimeInterval is a custom function. example:

const setToRoundedTimeInterval = (date: Date) => {

        switch (calendar.view.type) {

            case 'resourceTimelineDay': {
                return roundTo5minInterval(date) // Rounds to nearest 5minutes
            }

            case 'resourceTimelineWeek': {
                return roundTo15minInterval(date)
            }

            case 'resourceTimelineMonth': {
                return roundToHalfDay(date)
            }
        }
    }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scheduler Move, resize & create Example | Mobiscroll
Move events - grab an event and move it wherever needed. Resize events - change the length of en event, grab it from...
Read more >
FullCalendar timeGridWeek dragging or selecting time slot ...
I am using Fullcalendar timeGridWeek side by side with dayGrid. I can drag between the two and resize or drag ...
Read more >
Snap in to times | 1.5.88 - CalenGoo
It is useful to schedule events and see which time slots are free. As mentioned above, it works fine if you are using...
Read more >
OWA Calendar Displays Different Time Slots and Zones
The OWA calendar can display time slots of different lengths to ... time scale that works best for the kind of events that...
Read more >
Can I set a 15 minute intervals as Time Slots??
DayPilot Lite only supports 30 minute time slots. I recommend switching to DayPilot Pro if ... Event moving and resizing ....getting away with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found