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 dates passed to daygridMonth header

See original GitHub issue

Reduced Test Case

REDUCED TEST CASE.

Bug Description

Describe how to recreate the bug.

Use props dayHeaderFormat or dayHeaderContent to change header display on daygridMonth. In both cases the date passed to those functions is incorrect - points to Jan 1970.

What do you expect to happen?

Correct date should be passed to formatting/rendering functions just like in the other views.

What happens instead?

Incorrect date is passed - it’s always Jan 1970.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pdcmoreiracommented, Apr 1, 2022

When FullCalendar wants to pass just dates (ignoring time) or, like in this case, just a bit of information from a date, it passes a Date object with the hours set to 00. The problem is that Date always considers the local timezone, so in places with negative offset, it becomes the previous day.

Example when working with a UTC-3 timezone: image

The solution is, parse it as UTC with moment:

dayHeaderContent({ date }, h) {
  return h('div', {}, moment.utc(date).format('ddd'))
}
2reactions
Dominik-Kohlercommented, Feb 3, 2021

I would also expect it to behave like v4: Incorrect(v5): InCorrect

Correct(v4): Correct

As ‘dayHeaderFormat’ currently no longer works properly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Incorrect year passed to dayGridMonth header in ...
The dayHeaderContent and dayHeaderFormat hooks passes on arguments wrong date on dayGridMonth view, they always point to January 1970?
Read more >
validRange - Docs - FullCalendar
Limits which dates the user can navigate to and where events can go. ... Dates outside of the valid range will be grayed-out....
Read more >
Edit week day names to show fullname instead of short
Is there any way we can fetch the location on the calendar alongwith the event name? And can I hide the past events...
Read more >
Insert the date or time in a header or footer - Microsoft Support
For example, in an expense report form template, you might want start and end dates for the expense period to print in the...
Read more >
@fullcalendar/daygrid | Yarn - Package Manager
fixed: timeline view (without resources) problem with expanding height (#5792); fixed: locales not working in IE11 (#6790) ...
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