hi,
i am using http://arshaw.com/fullcalendar/ to display a calendar.
It uses json to populate the calendar events.
The JSON looks like this events: [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d-3, 16, 0), allDay: false } ]
A date looks like Fri Jul 29 2011 22:54:08 GMT-0400 (EDT)
When i select from my events table i run: @member_calendars = Member::Calendar.find_by_sql("SELECT * from calendars") @json_calendar = ActiveSupport::JSON.encode(@member_calendars)
How can i get my dates into a format that works for this json object?
Also, how would i pull my json object into the view so i can play with it in javascript.
The following code treats my json object as a string:
var foo = '<%= @json_calendar %>'; $.each(foo, function(i, item) { alert(i); });
It will alert each and every character from my object