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.

Prev button not working in custom dayGrid view when dateIncrement is shorter than duration

See original GitHub issue

I am using v 4.0.2

This is the code for my custom view : ` document.addEventListener(‘DOMContentLoaded’, function () { var calendarEl = document.getElementById(‘calendar’);

        var calendar = new FullCalendar.Calendar(calendarEl, {
            plugins: ['interaction', 'dayGrid', 'timeGrid'],

            defaultView: 'dayGridTwoWeeks',
            views: {
                dayGridTwoWeeks: {
                    type: 'dayGrid',
                    duration: {weeks: 2},
                    dateIncrement:{weeks:1},
                    visibleRange: function (currentDate) {

                        return {
                            start: moment(currentDate).startOf('week').toDate(),
                            end: moment(currentDate).endOf('week').toDate()
                        };
                    },
                    
                }
            },

            firstDay: 1,
        calendar.render();
    });

` I basically want a two week view with the ability to shift weekwise. While this works very well for advancing a week, the previous button gets broken after one use.

When clicking on the next button, I can go back again. But still only one week, so once I move 4 weeks in the future, I can only return to 3 weeks in the future.

Moreover, the today button does not work when I move one week back.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
josh4cscommented, Sep 4, 2019

Its a bit of a fudge but you should be able to achieve it with the below code additions. Bootstrap plugin is required for the chevron but you could use special characters. Hope it helps

customButtons: {
    backButton: {
        click: function () {
             calendar.incrementDate({ days: -1 });
        }
   }
},
bootstrapFontAwesome: {
    backButton: 'fa-chevron-left'
},
header: {
    left: 'today backButton,next',
    center: 'title',
    right: 'resourceTimelineThreeDays,resourceTimelineFiveDays,resourceTimelineSevenDays'
}
1reaction
Capablanca4commented, Jun 4, 2019

Hello,

I have a similar problem using the plugin timeGrid in v4.2.0

I basically want to display a 3 weeks calendar with the ability to shift forward and backward by one week. It works fine when moving forward but moving backward works only the first time. Afterward, if you click on the next buttons, you move 2 weeks forward.

Here an example to demonstrate the problem : https://codepen.io/capablanca4/pen/Ybgwyw

To reproduce the problem first select the 3 weeks view (3 week button), click on the next, and then twice on the previous button.

How to avoid this bug ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-Month View with different duration and dateIncrement ...
Next button works fine, but clicking the prev button triggers event loading twice. On the first time the calender steps 6-month backwards the ......
Read more >
@fullcalendar/daygrid | Yarn - Package Manager
prev button doesn't work when previous days are hidden by hiddenDays and dayCount is greater than dateIncrement (#4202) calendar locale not used in...
Read more >
Calendar widget - GitHub Gist
Calendar widget. GitHub Gist: instantly share code, notes, and snippets.
Read more >
fullcalendar-view--3109717-4.patch - Drupal
+// By default, all elements that are shorter than the recommended height are expanded uniformly, not considering +// any other els that are ......
Read more >
0003-add-calendar-cell-static-files-16393.patch - Combo
stale calendar title when navigate away from then back to the a view ... dateIncrement not working when duration and dateIncrement have different...
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