[Solved (kind of)] Event with multiple Dates

I have an event (a film) that happens at several times, for example:

1/1-2019 12.00
1/1-2019 15.00
4/1-2019 16.00

etc.

It seems like a can make a Tuple or a List with value-type "schema.Date".
I assume I will need to set 'end' to catalog it(?)

Has anyone done something similar (suggestions welcome)?

set 'end' for which purpose?
index 'end' for which purpose?
Rephrase your question and think about first about what you want to ask.

-aj

plone.app.event offers recurring events. You can use this feature in custom types as well.

Does the 'event' show correctly in calendar portlet etc. if it only have a start date?

True, but it UI is a bit confusing ( I dont want the 'repeating bit'), and I need different (and multiple) times for the dates (does not look lik recurring events support that)

"start" and "end" in plone.app.events are being indexed using a special DateRecurringIndex.

For your usecase I would create a folderish meta-event container holding all the event metadata and the related start dates + duration of the films. Upon create/edit of the meta-event type I would create/update event instances inside the container - one event for each film date. Everything else appears too complicated or too much bending Plone.

1 Like

Just to be sure before I change approach/strategy:

I did a test with a custom indexer, and this works (of course, it only adds the first date):

@indexer(IDatesBehavior)
def startIndexer(obj):
    return DateTime(obj.start[0].isoformat())

(it returns : DateTime('2018/06/13 20:55:00 GMT+0') )


Is there any chance that returning a list, a set or something else could work, something like:

@indexer(IDatesBehavior)
def startIndexer(obj):
    if obj.start is None:
        return None
dates = []
for date in obj.start:
    dates.append(DateTime(date.isoformat()))

return dates

… would return:

[DateTime('2018/06/13 20:55:00 GMT+0'), DateTime('2018/06/20 20:55:00 GMT+0'), DateTime('2018/06/20 21:00:00 GMT+0')]

You approach does not make sense - for obvious reasons.
Go with the sketched solution.

-aj