How can I add the holiday name in full calendar?

0

I need to show the nombre of an event but I do not know how to apply it in this case, I use fullcalendar and I want to show me the nombre of holidays, currently with código only shows the day with colors depending on whether it is Sunday or optional.

 renderHolidays(){
    this.holidays.forEach(element => {
      var formatDate = moment(element.date).format('YYYY-MM-DD')
      if (element.timeZone === 'fullDay') {
        $("td[data-date=" + formatDate + "]").addClass('holiday2');
      }
      else {
        $("td[data-date=" + formatDate + "]").addClass('holiday');}
    });
  },
    
asked by Jeypi 01.08.2018 в 15:49
source

1 answer

1

For what you want to do, just pass the name and date in the configuration. Specifically in events :

events:[{ title: 'Feriado', start: '2018-08-01' }] 

I'll attach a complete example:

<html>

  <head>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.css">
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.2/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.js"></script>
  </head>

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

<script>
$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,basicWeek,basicDay'
    },
    defaultView: 'month',
    events:[
    	{
            title: 'Nombre Feriado',
            start: '2018-08-01'
        }
    ]    
  })
</script>

Greetings, colleague!

    
answered by 01.08.2018 в 16:39