Hey #Trailblazers,
In this blog post we will discuss how we can implement the Lightning Calendar in Lightning Web Component using Full Calendar V3 Library.
Full Calendar library has many features that we can use to display the event information. To read more about this Visit https://fullcalendar.io/
Now, let’s say that a business wants to display the information about the events inside a particular record page, home page or app page and that has the ability to display the event information in a modal and can drag & drop the event.
Here is the Link which has to update the code.
Download the V3 Full calendar Js from https://fullcalendar.io/ and upload as static resource in Salesforce Environment.
Create a Lightning Web Component and use below code
Now, Create Apex Class and use below code. Apex Class is used to get the Event from the Salesforce Event object
You can find the full code here including static resource
https://github.com/amitastreait/full-calendar-js
Add your component inside any record page, home page or app page and see the demo


Thanks for reading 🙂
Sharing is caring 🙂 If you have any query please feel free to put down into the comment section.
#Salesforce #SFDCPanther #DeveloperGeeks
Love you brother!! After almost two weeks I landed onto this blog and finally I am able to load/see calendar. Thank you so much brother! 🙂
I have task and event both need to show on calender but task is appearing before Event while i want Event to come before Task do any one know is it standard behaviour
I have no idea on this part.
In this full calendar code you have written.. How to optimize the calendar view based on browser decrease and increase the screens or How to show the full calendar for desktop, tablet,ipad ? let me know how can I do
You can use either lightning layout or you can use media screen css
Hi, can you please post Resources and Events – Fullcalendar scheduler – https://fullcalendar.io/docs/timeline-custom-view-demo in Salesforce Lightning(not in LWC) ? Or you can guide me how to do that in salesforce lightning ?
When you say Salesforce Lightning(not in LWC), What are you referring to?
Hi,
Thanks for the wonderful blog 🙂
can you please help me with implementing this or post a blog on it
https://fullcalendar.io/docs/timeline-custom-view-demo
TIA 🙂
Hi,
I have checked the link that you have mentioned and can see the codepen code for the same. Are you facing any problem?
Hello, I hope you still follow the thread. Where do I put the code from the codepen to make my calendar like this one on the link ?
Thank you
Yes. I am following. However, I am not getting time these days so I am not able to help you where to put the code. You can check how the calendar is being prepared then make the changes accordingly
I have implemented your blog and now I want to change that to resource timeline. Can you please tell me where I have to make changes and what changes should I make. Thanks
You need to read the document of full calendar and then make the changes accordingly.
Hi,
I have downloaded and uploaded fullcalender 3.10.0 version ,uploaded in static resource and added the LWC and Apex class codes above, but resources are not accessible in the LWC, not sure why. could please let me know what could be the reason
Failed to load resource: the server responded with a status of 404 (Not Found) -/resource/1602750041000/FullCalendarJS/jquery.min.js
/resource/1602750041000/FullCalendarJS/moment.min.js
/resource/1602750041000/FullCalendarJS/fullcalendar.min.css
Try with the static resource that I have provided into the Repo.
i am getting same issue….can you help me
Try with the static resource that I have provided into the Repo.
Thanks a lot buddy. This helped me a lot. I have previously implemented the Calender using Aura Component. If anyone wants that I can share the code.
In Lwc one problem still I am facing is ex: in event click you are assigning the event to LWC @track variable selectedEvent. But that is not getting assigned.
My requirement: I need to call LWC js methods on event click and eventResize. but when we use this.somelwcmethod, this will not work since this is being assumed as Calendar`s related.
So I have created another module in js and made it to work. But I want to know how that conflict of this can be resolved.
Hi Amit,
Getting below error:
FullCalendarJS/fullcalendar.min.css net::ERR_ABORTED 404 (Not Found)
FullCalendarJS/theme.js 404 (Not Found)
/FullCalendarJS/moment.min.js 404 (Not Found)
/jquery.min.js 404 (Not Found)
FullCalendarJS/fullcalendar.min.js 404 (Not Found)
Hey,
Please check if you have the static resource in place if not then use the same as I have given in Repo.
Hi Amit,
Will this work in mobile ? Can we create events from mobile to calendar part?
Hi Sundar,
I have not tried this but you can give this a try.
Hi,
This works great! But, how can I put in a different theme for the calendar that is more updated looking.
Thanks!
Hi Jay,
Thanks!
Try to check the Full Calendar API for the theme and then try the same in the code.
I am still getting Errors… I put everything repo you provided into static resources
Getting below error:
FullCalendarJS/fullcalendar.min.css net::ERR_ABORTED 404 (Not Found)
FullCalendarJS/theme.js 404 (Not Found)
/FullCalendarJS/moment.min.js 404 (Not Found)
/jquery.min.js 404 (Not Found)
FullCalendarJS/fullcalendar.min.js 404 (Not Found)
You have to deploy all the components to Salesforce before running the code.
Hi, My calendar is working but I am very stuck. I want to use NavigationMixin on the eventclick to navigate to record page. I can make this work outside the calendar, but inside it always comes up as function undefined. How can I call a function within eventclick that uses NaviagtionMixin? Thanks for your help! This one is killing me…. I cannot seem to reference any function as “this” does not seem to reference my class.
You can use the below code as this will not work inside that method.
let url = 'https://'+location.host+'/'+event.id;
var eventRecord = window.open(url, "eventRecord");
eventRecord.location.reload(true);
Thank you, this worked!
Is there any blog or post the same thing can be implemented in lightning component?
There must be many blogs. All you need to do is search for the same.
StackExchange
BlogPost
Hi Amit,
I have done as you mentioned but it is not working. The root files are missing from the Zip folder and i am getting the following errors. I would be grateful if you can share those files to my email id.
fullCalendarJs.js:4 Object
eval @ fullCalendarJs.js:4
/resource/1608632982000/FullCalendarJS/jquery.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/resource/1608632982000/FullCalendarJS/theme.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/resource/1608632982000/FullCalendarJS/moment.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
/resource/1608632982000/FullCalendarJS/fullcalendar.min.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
fullcalendar.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Thank you Gaurav!
Here is the link from where you can get all the fiels
FullCalendar JS
Hi Amit,
I was facing same issue, resource 404 not found, ended up uploading all files individually.
But would like to know why facing problem with the zip file. tried with namespace as well but no luck.
Steps I took:
-Created all 6 files in local from your drive, copy pasted
-Moved all files in a new folder, renamed and zipped it
-Uploaded in static resource, rechecked the label and use it in LWC js file.
Thanks for awesome work
Thank You 🙂
A note for everyone here, just failed security review due to the jquery version that Calendar 3.10 uses. Hope I can save you some time, you need to go to a higher version, and that plays nowhere near as nice with LWC.
Just a heads up, if you are building this for app exchange you will probably need v4 or v5. I have been using this for a number of years and my latest package was bounced from security review due to vulnerabilities in v3 and the jquery version it uses. Would love to see this updated to v4 or if you are up for a serious challenge v5. I have been banging my head against that all morning and it looks like a lot of people are struggling with it.
Thanks for the update.
Got this all setup on my org without an issue. Just one thing that I cannot get working is the event click to show the modal pop up. I have the this.selectedEvent = event but the modal never shows. I printed out the track values but those never seem to change either. Have you seen any issues with this or any idea on how to solve this? Thats my only roadblock so far. Thanks!
Hi John,
I am also trying the same but not able to make it to work. I believe there is something wrong and I am still trying to figure this out.
Any luck on this yet and thanks again for the awesome work!
Unfortunately I was not able to look into this due to some health issue.
Hi John & NK,
Please find the latest code which include the Modal Popup and the Created Record as well when user click on any day.
Here is the Link for the same – https://github.com/amitastreait/full-calendar-js/tree/master/latest
[…] displays all the Tasks for the Logged In Users in the form of a Calendar. You can take help from This Blog Post. And Add this Component to Home Page. Also, Give the Ability to Select the Project as […]
Hi Amit
It’s working fine for me but I wnat to display Holidays in different color.
is there any way to display holiday in different colors?
Thanks In Advanced!
If you see the full calendar document you will find there is an attribute to define the colours
Hi
am getting an error like this
‘Invalid reference FullCalendarJS of type resourceUrl in file fullCalendarJs.js’
You have not uploaded the static resource to Salesforce.
No i have already uploaded the static Resource with the name as FullCalendarJS and still getting the same error.
You can check below comments by a blog reader
Hi Amit,
I was facing same issue, resource 404 not found, ended up uploading all files individually.
But would like to know why facing problem with the zip file. tried with namespace as well but no luck.
Steps I took:
-Created all 6 files in local from your drive, copy pasted
-Moved all files in a new folder, renamed and zipped it
-Uploaded in static resource, rechecked the label and use it in LWC js file.
Thanks for awesome work
Hello Amit Sir ,
Can you please guide us how to use moment timezone plugin in the lwc since we wanted to show according to the timezone as per the logged in user and if I am using the below link reference it is showing us the below error
TypeError: t.createPlugin is not a function
from the following main.global.min.js
The link which I am using as a reference for Moment time zone is below
https://fullcalendar.io/docs/moment-timezone-plugin
You have a timezone field where you can provide the timezone like below – timeZone: ‘America/New_York’
Hi, I followed all the steps, unfortunatly my LWC is only showung All Calender word. Except that no calender is showing, may I know how can I fix that?
You need to check if there is any error in the javascript.
Hello Amit
After clicked on event title pop up modal not open.
What is the code for onclick?
Hi Amit sir,
I have gone through your blog and I have implemented the same with everything deployed properly. But I am facing an error when I try to preview that LWC component. Here is the error can you please help how to resolve this.
Uncaught TypeError: Illegal invocation
throws at https://cacloud-dev-ed.lightning.force.com/resource/1630572473000/FullCalendarResource/packages/core/main.js:126:30
Hi Amit
Can you please help me. I have deployed everything properly according to your blog. nd the calendar is visible. But it is displaying the error.
Uncaught Type Error: Illegal invocation
throws at https://cacloud-dev-ed.lightning.force.com/resource/1630572473000/FullCalendarResource/packages/core/main.js:126:30
Can you please guide me how to resolve this.
This is a known issue. Please check the below link
Github issue
Thanks a lot Amit. The issue is resolved. But when we click on the calendar then a pop should opened so that we can create the events. So will it be feasible in it?
That is already there in the code.
No I have tried the code but only the events(Appointments) that are created in salesforce are reflecting there but what I want that on clicking any time there should be a pop up to create the events.
Yes. You have to implement onclick method to open the popup and create the record. This is what I can help you with
Yes please can you guide how to create that onclick method. It will be very helpful for me.
Thanks
That is already there in the code.
Hi, I want test class for Event Calendar .. If I provide the code can you help me with test class?
It is a very simple class and the test class is very very easy. So, you have to write on your own.
Hi Amit,not this code, I will provide different code I am facing some issues in that
Unfortunately, we do not write code on behalf of you.
Hi
I tried everything but the “fullcalendar” css sends an error and wont display the calendar.
I have read the comments and tried multiple options and haven’t had any luck, any suggestions?
Are you getting any errors?
Hi Amith,
Thanks for the blog and it so informative
I have a requirement need to create a custom component to create Event calendar for Accounts
On Calendar- Other Calendar settings – ability to create an event calendar for an Account or other objects(instead People).
Component to include:
List of today and future events related to an account
User filter required to select single or multiple accounts
How to achieve this?
Many Thanks,
Latha
Hi Laths,
This is the customize requirement that you are talking about. You need to create a multi select lookup component which will search for accounts and then upon clicking on find events then you need to call the Apex Class Method which will accept List and then filter the events based on WhatId.
Hi Amith,
Thanks for the quick response…
I could able to create custom lookup to select an Account…
Hi everyone,
The current repository is working fine for me but when I try to load the latest library files, I am getting an error in console. The calendar does not load as well. Could someone please help me?
Versions I am trying to use:
fullcalendar.min.js – v5.10.1
fullcalendar.min.css – v5.10.1
jquery.min.js – v3.6
moment.min.js – v2.27
theme.js – v4.4.2
The following error is captured in the “catch” of Promise() to load the scripts
{message: ‘Error occured on FullCalendarJS’, error: undefined}
error: undefined
message: “Error occured on FullCalendarJS”
The latest version of Libraries are not supported for LWC so far.
Thank you for the reply. Could you please tell me how can I find what is the latest version that is supported for LWC? I am trying to implement timeGrid view which is only available in fullcalendar version 4 and above.
The lib which I have used is the currently supported version. If you want to use the latest version then use Aura Component instead
Hi everyone,
I am trying to add the LWC generated from this to a Vlocity OmniScript and receiving the following error. Could anyone please let me know if they tried/imported an LWC using fullcalendar.js into a Vlocity component?
“Assertion Failed!: Scoped imports not allowed when a runtime namespace is specified”
Thanks,
I have no idea about velocity however I have found below link –
https://salesforce.stackexchange.com/questions/339383/scoped-imports-are-not-allowed-when-runtime-namespace-is-specified
Thanks for sharing your component. I am looking to change the “day” to “Day”, “month” to “Month” etc. Can you please help me where do I need to change it?
I do not think this is possible.
Hi, how to pass user timezone to the calnder.io from LWC
Check below link – https://fullcalendar.io/docs/timeZone
Superb