I have an Entity called Event, with fields startDate, startTime, endDate and endTime. startDate and endDate are dates of which endDate can be NULL if it is the same of startTime (I can change this behaviour if it makes things easier as I have no events yet). startTime and endTime can not be NULL. It also has an isOnDate(\DateTime $date) method, which returns true if the event will run on the given date.
It was like pain, but I finally generated an HTML table of any given calendar month, passing the day of week of the month's first day (firstDow) and the number of days in that month (numDays) as template variables.
The next step would be to make some table cells links to event or event listing pages if the given days has one or more events. Now I'm a bit stuck, as I don't know how to get the DateTime() object of each cell in a template.
Can someone give me a hint on this? Or am I making it totally wrong?
You can display DateTime Objects as Text Dates using Twig Filter date:
{{ event.startDate|date("m/d/Y") }}
You could use Ajax and jQuery to link dynamically your page with your database. You could start from this calendar code for Symfony2: http://www.symfocal.com
Related
I am using fullcalendar.io and I realized that if I create a new event in the month view, dragging across one or more days, it returns a timestamp for the end date which is later rendered as 12 am of the day after while it should be logic that a function date("what-ever-format", timestamp) returns 12 pm of the current day, or, in any case, not the following day.
Any idea how to fix this???
I have training events from database and their start and end dates are in this format "YYYY-MM-DD". For example is:
{
'title':'English Training',
'start':'2015-05-19',
'end':'2015-05-23'
}
But when it is rendered in calendar, it shows wrong end date
I tried adding 12hours on endDate (*just like the answer * here) , and yes it works but now I'm unable to extend the day for an event.
I want to fix this wrong end date issue without losing the capability to extend events. Do you know any solution or hacks?
Adding 12 hours on the endDate of your event won't make it an allDay event anymore, which is why you will loose the ability to extend your event in month view.
However, adding 1 day on the endDate will work perfectly as :
Your event will remain an allDay event (so it will remain extendable)
Your endDate will become 2015-05-24 (understood by FullCalendar as 2015-05-24T00:00:00) which means that your event will end at the very first minute of 2015-05-24 which is what you want.
To conclude : if you want an allDay event to end at midnight of day1, you have to set its endDate as day2 !
I'm trying to work with the ASP calendar control and (for starters) highlight the specific days on the calendar that matches DueDate in the 'task' table. I know how to highlight a cell using the DayRender event, but how do I do this in accordance to the database table?
Would then also like to be able to click on the highlighted cell and see details of the task associated to that date in some sort of box next to the calendar.
Any pointers on how I can solve this?
Pseudo-code:
Determine your desired date range (probably a certain month)
Read all the tasks that have due dates within that date range (probably need Name and DueDate at least)
In your DayRender handler you check if current day's date exists in the loaded tasks's due dates, if it does, highlight it with the color of your choice
In you SelectionChanged handler you obtain the selected day's date, and look through the loaded list of tasks for any tasks that have that date as their due date, and populate whatever box with those tasks.
I need to put start date and end date on my page.
It will be only month and year date, with day set to 01 in the start date and to last day of month in the end date.
How can I achieve this feature?
I have tried the Ajax MaskedEditExtender, but when I put 99/9999 in the mask, with the maskType="Date", it give me a javascript error, because the day is missing.
I take it you are trying to validate the entry. I suggest you use a CustomValidator - you'll need to write your own JavaScript for the client-side validation and another validation method for the server-side validation. All you need to do is split the string on / and check the first part is in the range 1..12 and the second part is a valid year.
I have a event data which contains startdate and end date , i want to see the calendar holding that event,now what is happening is it is showing the current week calendar ,but if my event having previous week satrtdate means i have to go to previous week and and i can able to see the event data in calendar..but i want to focus that date calendar at first shot itself..pls do the needful its urgent, i think i have to change something in fullcalendar.js but i dont know where to change pls do needful
Check the documentation for FullCalendar... http://arshaw.com/fullcalendar/docs/current_date/
This shows parameters that can be set to get the calendar to initate at a particular date.. by default it will always start at todays date.