Dynamic model attributes

Hi folks,

I’m trying to add a dynamic attribute to my model, which should be interpreted as late as possible.
For example: A model ‘Event’ with the attributes startDateTime and endDateTime. I would like to add a new attribute state as an enum (‘future’, ‘live’, ‘past’) depending if the current time is before, in between or after startDateTime and endDateTime.

Event

  • startDateTime: DateTime
  • endDateTime: DateTime
  • state: enum (‘future’, ‘live’, ‘past’) dynamic depending on the current time

What would the best way to archive this?

Thanks for your help
Best
Alex