Creating Events before/after an event


I'm trying to create a macro which allows me to input an event into fantastical and then create an event for travel 30 minutes before the beginning of that event (for 30 minutes) and an event for travel for 30 minutes following the event. Everything is working except for the time calculations before/after the main event. Is there a way of having KM +/- time from a date set as a variable?


Hi @Sam_CG - there was a very recent discussion about this. Check it out here:

and here:

Thanks @tiffle .

I can't see how to make that work with a variable from a user input - 'ward visit date time is' where the variable which I want to add/subtract time from.

A date time value needs to be an integer string representing Unix Epoch seconds (if you want to apply any arithmetic to it) so:

  1. We capture the initial value in a field with a Date and Time type, and
  2. we supply a default in terms of a function like NOW(), which returns an integer string (seconds since the start of 1970)

For example:

30 mins before and after entered time.kmmacros (4.2 KB)

1 Like

That works perfectly. Thank you @ComplexPoint

1 Like