pepe
pepe

Reputation: 9919

jQuery fullCalendar dayClick - convert (date) to mm/dd/yy

I am trying to the following:

This is my code:

$("a#inline").fancybox();

$('#calendar').fullCalendar(
{
    dayClick: function (date)
    {
        $('a#inline').click();
        $('.datepicker').val(date);
    }
});

HTML

<a href="#data_entry" id="inline">Add Event</a>

<div style="display:none">
    <div id="data_entry">
        <form action="events/events_save" method="post" name="events_form" id="events_form">
         <input type="text" name="date" value="<?php date('m/d/Y'); ?>" class="datepicker">
        </form>
    </div>
</div>

I am running into the following issues:

Anyone have suggestions on how to solve either issue?

Thanks a ton.

Upvotes: 0

Views: 9392

Answers (2)

GDubYa
GDubYa

Reputation: 61

Perfect! This helped me out too as I could not find any documentation on how to use formatDate method...

alert($.fullCalendar.formatDate( calEvent.start, "yyyy-MM-dd"));

Upvotes: 1

justkt
justkt

Reputation: 14766

To format dates, run the date through fullcalendar's formatDate method. Try:

$('.datepicker').val($.fullCalendar.formatDate( date, "MM/dd/yy"));

Upvotes: 9

Related Questions