Problem/Motivation
When the FullCalendar block was loaded with URL parameters (like view filters), but without a valid date parameter, the calendar would incorrectly default to December 1969 (near Unix epoch 0) instead of the current date.
When processing URL parameters, the code attempted to create a date from the startParam value even when it was present but empty or invalid. This resulted in an invalid Date object that, when converted to a timestamp, was interpreted as December 1969.
Steps to reproduce
1. Have a full calendar view with exposed filters see https://www.drupal.org/project/fullcalendar_block/issues/3394725#comment...
2. When exposed filters added like /calendar/month?field_event_collection_target_id=96 see how initial display shows Decemeber 1969

Proposed resolution
Proper validation before attempting to create a Date object:
Checks if the startParam value exists in the URL
Verifies the value is not empty after trimming
Only then attempts to parse it as a date
Only sets initialDate if a valid date was created
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | week view.png | 228.84 KB | mingsong |
| #11 | Month view.png | 271.38 KB | mingsong |
| #11 | block setting.png | 192.24 KB | mingsong |
Issue fork fullcalendar_block-3513678
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
nicholassAfter this change if no start date in query param it does not default back to Dec 1969
Comment #4
mingsongFirst of all, any issue caused by an invalid parameter is not a bug.
Secondly, the Initial date parameter is optional, which mean if the client don't want to change the default initial date, which is the current day, no need to have the parameter in the URL at all. If the client does want to change the default initial date, then a valid date must be provided. If an unexpected initial date presented, please check the URL that you are visiting.
After all, this module doesn't provide any Drupal view. The view mentioned in the description of this issue is an example attached to the tutorial article.
Comment #5
mingsongComment #6
fallenturtle commentedI have the same situation as @nicholass. It doesn't make sense from a UI perspective to have an exposed start date field for a calendar display like this since we are relying on FullCalendar to provide the calendar navigation.
Is the best solution to add the exposed start date filter to the filters on the Page display and then hide it with CSS? I suppose the alternative would be to add a hook or something that will add &start= to the end of the URL parameters when ever the filter is applied.
Comment #7
mingsongI think there is a misunderstanding here.
The “start” parameter sent to the data source endpoint by the FullCalendar.js is the beginning of the date range of the dataset required by the FullCalendar.js. For example,when switching weeks or months, the FullCalendar.js will send out a HTTP request to the data source endpoint with the start date of that week, in your case, it is a request to the Drupal view built by you, not this module. This module has nothing to do with any Drupal view.
The “start” parameter in the URL to where the calendar block is placed is actually the “initial date” when the calendar should display at the beginning. Which is optional custom parameter.
Again, this module does not include any Drupal view, that is saying no patch to this module can help you to solve the problem with the view created by you.
Comment #8
mingsongIf you are using a Drupal view to provide the data to the calendar, I think you might want to try other module,
For example, https://www.drupal.org/project/fullcalendar
Which is straightforward and simpler.
Comment #9
paulmckibbenHi @mingsong, this is a legitimate bug. We have an instance of a fullcalendar_block that has this problem immediately after login.
On initial login, the system appends ?check_logged_in=1 to the query string. When this happens, and there is no start parameter in the query string, the initialDate gets set to Dec 1969.
The MR fixes the problem for me.
Comment #10
mingsongHi @Paul, Thanks for confirming the patch work for you.
Please provide your Drupal core version and the steps and conditions (only authenticated user?) to reproduce this issue.
I will try to test it in your situation. Once I can confirm this issue on my end, I’ll be more than happy to have it fixed.
Comment #11
mingsongOk, I did a quick test with Drupal 11.1.
Drupal version: 11.1.5
Fullcalendar block version: 1.1.1
Here is the steps I took.
According to my test, I couldn't reproduce this issue under any circumstance. The initial day is the default current day.
Month view

Week view

After all, if this issue requires a Drupal view to trigger, then it is out of scope as this module doesn't provider any Drupal view integration.
Comment #12
mingsongOk, I think this issue does not only happen to Drupal view but any data source hosed on the same domain. Further more, it doesn't only affect authenticated user but all users if there any parameter in the URL. For example, /?hi=1
Comment #13
mingsongComment #15
mingsongThis issue is worse than my thought previously. Sorry for not looking at it closely.
I create a new patch with a clearer logic and clarify the difference between the 'start' parameter in the query parameter and the one fed to data source endpoint.
You can get the patch from https://git.drupalcode.org/project/fullcalendar_block/-/merge_requests/1...
According to my own test, I believe it is fixed by the patch. So I am going to release a new version shortly for this fix.
Comment #16
mingsongComment #18
mingsongFixed with 1.1.2
Comment #22
codebymikey commentedThe original issue was caused because the new code I implemented not accounting for if the
query.get(startParam)was empty (I assumed passing anullinto Date would've led to an invalid date, but I guess not, so my bad guys!).I believe exposing the
initialDateproperty as a configuration is useful since a site installation might use thestartquery string for something else, and for most use cases the startParam is usually also theinitialDate. I've created a new MR adding the functionality.Comment #23
mingsongThanks @mikey,
Looks good to me.
Comment #25
mingsong