get the date in fullcalendar’s select event

Asked

Viewed 1,545 times

3

I’d like to know how to get the value of data by doing the select of a day in fullcalendar

 select: function(start, end, allDay) {
        start = $.fullCalendar.formatDate(start, 'yyyy-MM-dd');
        alert('Valor da data: ' + start);
 }

I’ve been doing it but it doesn’t work

2 answers

3

Reading the documentation they suggest using the .formatRange(), and you can use the same day at the beginning and end of that range/range. Also note that I use uppercase in date format: 'YYYY-MM-DD'.

Thus:

select: function (start, end, allDay) {
    start = $.fullCalendar.formatRange(start, start, 'YYYY-MM-DD');
    alert('Valor da data: ' + start);
}

jsFiddle: https://jsfiddle.net/1y8a6rce/

  • 1

    worked perfectly, thank you!

  • @Great speed! If you want you can mark the answer as accepted.

1

I got it like this :

selectable: true,
      select: function (start) {
        console.log(start.startStr);
        alert('Valor da data: ' + start.startStr);
      }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.