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.

incorrect navLink for granularities other than day/week

See original GitHub issue

Hi,

Using navLinks, the day header from resourceTimelineWeek links to resourceTimelineMonth (instead of expected resourceTimelineDay), even with explicit setting navLinkDayClick.

Test case: https://codepen.io/anon/pen/QPzLgo

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
arshawcommented, Aug 6, 2019

The problem here is that the navLink*Click handlers are called in more specific situations that you might think. For example, navLinkDayClick only happens when a whole-day cell is clicked. The reason it’s not firing in the codepen is because an hour-granularity is being clicked (which would hypothetically need navLinkHourClick).

We would need to improve the API to make this less awkward. I’ll propose navLinkClick:

navLinkClick: 'resourceTimelineDay' // for anything that's clicked

// OR
navLinkClick: function(dateClicked, granularity, jsEvent) {
  console.log(granularity); // "hour"
  return 'resourceTimelineDay'; // will navigate to this view...
},

// OR
navLinkClick: {
  week: 'resourceTimelineWeek',
  hour: 'resourceTimelineDay'
}

2reactions
ecnaidarcommented, Aug 3, 2022

Used slotLabelDidMount workaround for React implementation, thanks for that

slotLabelDidMount={function ({ el, date, view, level }) {
  el.addEventListener("click", function () {
    // warning, this assumes that we have 3 levels of headers
    // lvl 0 will be week in all views
    if (level === 0) {
      view.calendar.changeView("resourceTimelineWeek", date);
      view.calendar.scrollToTime({
        day: (date.getDay() + 6) % 7,
        hour: 0,
      });
    } else {
      view.calendar.changeView("resourceTimelineDay", date);
      view.calendar.scrollToTime({
        hour: 0,
      });
    }
  });
}}

Not going to lie, it kind of boggles my mind that this have been hanging on the wall for 3 years already. Especially since it is basic functionality that is broken exclusively in “premium” part of FullCalendar 🙃

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript Event Calendar - FullCalendar
incorrect navLink for granularities other than day/week. 7. multiple timeGrid/timeline axis, each with different time zone.
Read more >
Root Navlink always get active class React Router Dom
For example, to render a link that is only active at the website root and not any other URLs, you can use <NavLink...
Read more >
Changelog | ArcGIS Hub
Fixed a bug where the site would crash when viewing a dataset with more than four categories in a locale other than EN...
Read more >
@fullcalendar/moment-timezone | Yarn - Package Manager
FIX: Expose globalLocales publicly for importing on-demand (#7057). React: FIX: multi-day events rendered by eventContent are overlapping each other (#7089).
Read more >
NavLink - React Router: Declarative Routing for React.js
This should be used if you want to do more than verify that the link's pathname ... "true" - used to indicate if...
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