Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I would like something like fc-event-past
to be added to events in the past. Then I can easily set them to fade (like Google Calendar).
Comments
Comment #1
aspilicious CreditAttribution: aspilicious commentedHeard this before. Let's try it....
Comment #2
aspilicious CreditAttribution: aspilicious commentedOk we are going to fix this :).
In theme.inc we have
$entity->class
and
We should add "fc-event-past" to entity->class if $date2 (== end date) < current date.
Probably there are date module functions for this. I'll ask Tim.
Sadly enough we can't do this in fullcalendar_fullcalendar_classes...
Comment #3
tim.plunkettSee attached.
There's no real easy way to expose what this class name should be, or if it should even be added, but this is fine.
Comment #4
pjcdawkins CreditAttribution: pjcdawkins commentedThat patch works for me.
Comment #5
aspilicious CreditAttribution: aspilicious commentedif we are going to do this I propose this code:
Comment #6
tim.plunkettI don't agree. With this code, it will only happen if you refresh the page on the EXACT second the event ends, not if you're in the middle of the event.
If we really want to add a bunch more code, we can figure out if we're in the middle of the event or not...
Comment #7
aspilicious CreditAttribution: aspilicious commentedAre you sure?
In the second test I use the start date of the event. So when you're in the middle it will choose 'fc-event-now'
Comment #8
tim.plunkettOh my brain/eyes skipped that part. Yeah I guess that's okay with me. Want to reroll?
Comment #9
aspilicious CreditAttribution: aspilicious commentedTomorow, need some sleep :)
Comment #10
pjcdawkins CreditAttribution: pjcdawkins commentedWell I don't know if this is the right etiquette but while you were sleeping I made a patch. I need more practice than you do. It's based on, but not identical, to #5.
Comment #11
tim.plunkettI like the use of REQUEST_TIME, forgot about that.
should be
elseif
Can you reroll again? More practice ;)
Comment #12
pjcdawkins CreditAttribution: pjcdawkins commentedRerolled
Comment #13
pjcdawkins CreditAttribution: pjcdawkins commentedWe need to check for all day events.
Comment #14
aspilicious CreditAttribution: aspilicious commentedWhat if I have an $all_day date in the past that will fail.
$all_day is an event that last one day (24 hours)
Comment #15
pjcdawkins CreditAttribution: pjcdawkins commentedOh good point! Something like...
Comment #16
aspilicious CreditAttribution: aspilicious commenteddo we cover all day events that are happening now? ;)
Comment #17
pjcdawkins CreditAttribution: pjcdawkins commentedThey'll be "now" by default, surely, because the start time will be < REQUEST_TIME and > midnight. I think it actually has to be:
Comment #18
aspilicious CreditAttribution: aspilicious commentedIf you reroll I'll test it. Tim has to decide if we want to add these extra classes and code...
Comment #19
pjcdawkins CreditAttribution: pjcdawkins commentedSure. There's another problem: events with no end date are assumed to have 0 duration, whereas the default duration should really be read from the FullCalendar settings... I think that should be dealt with in
_fullcalendar_process_dates()
, unless the Date module has a default duration setting somewhere that I've missed.Comment #20
pjcdawkins CreditAttribution: pjcdawkins commentedThe feature seemed simple when I opened the thread!... Marking needs work for #19, attaching a patch for other work up to #17.
Comment #21
tim.plunkettAccording to http://www.php.net/manual/en/datetime.formats.relative.php, it can just be strtotime('today').
I don't like wrapping code unless it's REALLY long, let's keep this on one line.
Comment #22
pjcdawkins CreditAttribution: pjcdawkins commentedOK, I've updated the patch. I haven't found a standard for giving events a default duration (where there is no end date specified), so I'm not sure how to proceed with #19.
Comment #23
tim.plunkettBy default, FullCalendar shows events with the same start/end as 2 hours long. That's configurable via the FullCalendar Options module.
Not sure that it really matters.
Comment #24
pjcdawkins CreditAttribution: pjcdawkins commentedWell, I don't think it matters that the time classes should respect default durations, it only affects events without end times set, only shortly after they've started, and only for those actually using these classes for styling. And this whole issue is minor anyway. And I'm using the patch in #22 successfully, in production.
Comment #25
tim.plunkettSorry for the insane delays.
Committed, thanks!
http://drupalcode.org/project/fullcalendar.git/commit/bc205ca