-1

I have a bunch of calendars all coming from Google calendars on a site and everything works great aside from the the events displaying in 24h format.

I have tried to set it in the jQuery code but I can't figure out the right code to do that. In the Google calendar settings they're all set in 12H so it has to be something in fullCalendar.

This is the only code I can find when I do a search and it doesn't seem to be doing anything:

$(function() {
  $('#calendar').fullCalendar({
    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    timeFormat: 'h(:mm)t',
    timezone: 'America/Toronto',
    googleCalendarApiKey: 'hidden',
    eventSources: [{
      googleCalendarId: 'hidden',
      className: 'calendar'
    }]
  });
});

Is timeFormat the correct line to control it?

Thanks!

0

1 Answer 1

0

The timeFormat option is the correct thing to set.

Now you need to consult the momentJS documentation (linked to from this fullCalendar documentation (which is in turn linked from the timeFormat documentation)) to know what format string you can use to get the times shown in your desired format.

For example:

timeFormat: "HH:mm"

will get you 24hr times such as 21:00 etc. You can amend this yourself if you need it to show something slightly different.

Demo: http://jsfiddle.net/8bx14goh/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.