Plugin Author
room34
(@room34)
Do you mean the events that have already occurred earlier in the day of the one day (“today”) that you’re showing?
Right now there’s not really a way to do this. I could look into adding it in a future update.
Thread Starter
imagn
(@imagn)
That’s correct. I need to hide the events that have already ended earlier in the day. Hopefully it’s something that could be added in the future. Thanks!
Plugin Author
room34
(@room34)
I have a kind of kludgy idea for how it could be done with a bit of JavaScript and the existing code structure of the plugin, but I’m reluctant to recommend it.
In short, after the page loads, I’d iterate through the list of events with jQuery('.ics-calendar .event').each()
. The plugin creates a CSS class in the form of thhmmss
for the start time of each event. (For instance, an event that starts at 8 AM would have a CSS class of t080000
.)
You could take the integer portion of that class, compare it to the current time, and hide any events that started in the past.
Of course, aside from being kludgy, this is not ideal because it would hide events as soon as they start, but I assume you want to hide them when they end, so you’d have to fudge that somehow.
Anyway… I think this explanation suffices to demonstrate why I’m not putting this into the plugin as-is… but it’s a start. I think I would probably modify the template to include data-start
and data-end
attributes in each of the events, with the value in hhmmss
format (no t
at the beginning), and use the data-end
value in the comparison against the current time.
-
This reply was modified 1 year, 8 months ago by room34.
Thread Starter
imagn
(@imagn)
Here’s another idea: What about only listing events from the current time moving forward? This way it works with events that don’t have an end time specified.
Plugin Author
room34
(@room34)
Right now the parser only works on a day-at-a-time level; there’s not a way to exclude events based on time. Adding to that the fact that the parsed data is cached (by default for 1 hour, but it’s adjustable), and it most likely needs to be a JavaScript-based solution.
Thread Starter
imagn
(@imagn)
Got it. To answer an earlier question, the main need would be to hide the item after the event has ended.