Controller: public class Calendar { public List events {get; set;} private static String dtFormat = 'EEE, d MMM yyyy HH:mm:ss z'; public Calendar() { } public PageReference pageLoad() { events = new List(); for (Curso__c cur: [SELECT Name, Fecha_de_Inicio__c, Fecha_de_Finalizacion__c, Frecuencia__c, D_as__c FROM Curso__c ]) { List dates = CalculateDates.getDates(cur.Fecha_de_Inicio__c, cur.Fecha_de_Finalizacion__c, cur.D_as__c, cur.Frecuencia__c ); for (Date dat: dates) { CalEvent course = new CalEvent(); course.title = cur.Name; course.allDay = true; DateTime d = (DateTime) dat; course.startString = d.format(dtFormat); course.endString = null; course.url = '/' + cur.Id; course.className = 'course'; events.add(course); } } return null; } public class CalEvent { public String title {get; set;} public Boolean allDay {get; set;} public String startString {get; set;} public String endString {get; set;} public String url {get; set;} public String className {get; set;} } } If you could let me know what I can do to fix this, I would be super grateful! Thank you", "answerCount": 4, "upvoteCount": 1, "datePublished": "2016-06-27T20:36:26.000Z", "author": { "@type": "Person", "name": "Cursos y Talleres", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000CNn2TQAT", "affiliation": { "@type": "Organization", "name": "--" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "I think there is issue with the date formatting or date zone for the organization. if you have a solution plz forward or paste in comments.", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4XkaSAF", "datePublished": "2019-03-20T13:07:21.000Z", "author": { "@type": "Person", "name": "skalva kalva", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000DApO3QAL", "affiliation": { "@type": "Organization", "name": "--" } } } ] } }
Skip to main content
Hi,

I'm trying to use FullCalendar to display a calendar in a VP page, but when I click "Preview", nothing renders. There are no errors when I compile, so I can't tell what the problem is. Below is my code:

VP Page

<apex:page controller="Calendar" action="{!pageLoad}" standardStylesheets="false">

<link href="{!$Resource.fullCalendarCSS}" rel="stylesheet" />

<link href="{!$Resource.fullCalendarPrintCSS}" rel="stylesheet" media="print" />

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

<script src="{!URLFOR($Resource.FullCalendar,'lib/jquery.min.js')}"></script>

<script src="{!URLFOR($Resource.FullCalendar,'lib/jquery-ui.custom.min.js')}"></script>

<script src="{!URLFOR($Resource.FullCalendar,'fullcalendar/fullcalendar.min.js')}"></script>

<script src="{!URLFOR($Resource.FullCalendar,'lib/moment.min.js')}"></script>

<script type="text/javascript">

var j$ = jQuery.noConflict(true);

j$(function() {

j$('⌗calendar').fullCalendar({

header: {

left: 'prev,next today',

center: 'title',

right: 'month.agendaWeek.agendaDay'

},

editable: false,

events:

[

<apex:repeat value="{!events}" var="e">

{

title: "{!e.title}",

start: "{!e.startString}",

end: "{!e.endString}",

url: "{!e.url}",

allDay: "{!e.allDay}",

className: "{!e.className}"

},

</apex:repeat>

{

}

]

});

});

</script>

<style>

⌗cal-options {float:left;}

⌗calendar {margin-top:20px;}

⌗calendar a:hover {color:⌗fff !important;}

.fc-event-inner {padding:3px;}

.course {background:⌗56458c;border-color:⌗56458c;}

</style>

<apex:sectionHeader title="Cursos Calendar"/>

<div id='calendar'></div>

</apex:page>

Controller:

public class Calendar {

public List<CalEvent> events {get; set;}

private static String dtFormat = 'EEE, d MMM yyyy HH:mm:ss z';

public Calendar() {

}

public PageReference pageLoad() {

events = new List<CalEvent>();

for (Curso__c cur: [SELECT Name,

Fecha_de_Inicio__c,

Fecha_de_Finalizacion__c,

Frecuencia__c,

D_as__c

FROM Curso__c

]) {

List<Date> dates = CalculateDates.getDates(cur.Fecha_de_Inicio__c,

cur.Fecha_de_Finalizacion__c,

cur.D_as__c,

cur.Frecuencia__c

);

for (Date dat: dates) {

CalEvent course = new CalEvent();

course.title = cur.Name;

course.allDay = true;

DateTime d = (DateTime) dat;

course.startString = d.format(dtFormat);

course.endString = null;

course.url = '/' + cur.Id;

course.className = 'course';

events.add(course);

}

}

return null;

}

public class CalEvent {

public String title {get; set;}

public Boolean allDay {get; set;}

public String startString {get; set;}

public String endString {get; set;}

public String url {get; set;}

public String className {get; set;}

}

}

If you could let me know what I can do to fix this, I would be super grateful! Thank you
4 answers
  1. Mar 20, 2019, 1:07 PM
    I think there is issue with the date formatting or date zone for the organization.

    if you have a solution plz forward or paste in comments.
0/9000