logo

FullCalendar

This version is a pre-release. Read the release notes

Calendar::formatDate

A method that formats a date into a string. It inherits the locale and time zone settings of the calendar it’s called on.

calendar.formatDate( date, settings )

date can be a Date Object or something that will parse into a Date Object.

settings is an object that holds any of the date format config options.

Example:

import { Calendar } from 'fullcalendar';

document.addEventListener('DOMContentLoaded', function() {
  var calendarEl = document.getElementById('calendar');

  var calendar = new Calendar(calendarEl, {
    timeZone: 'UTC',
    locale: 'es'
  });

  var str = calendar.formatDate('2018-09-01', {
    month: 'long',
    year: 'numeric',
    day: 'numeric'
  });

  console.log(str); // "1 de septiembre de 2018 0:00 UTC"
});