Error: Create Calendar Event failed because start time is too far in the past [Solved]

Need help in resolving this error:
Screenshot 2025-08-02 at 13.38.21

This is the macro:
try_creating_first_event_using_KM.kmmacros (18.8 KB)
Screenshot of the macro:

What i tried so far -
I tried following strings:
TIME(YEAR(2025),MONTH(8),DAY(9)+1,9,0,0)
TIME(YEAR(2025),MONTH(08),DAY(09)+1,9,0,0)
TIME(YEAR(2025),MONTH(8),DAY(9)+1,9,0,0)-GMTOFFSET()
TIME(YEAR(2026),MONTH(8),DAY(9)+1,9,0,0)

I tried choosing different calendar from 'To calendar' list.

I tried ticking the checkbox for 'all day'.

So, that Action needs the date and time of the event to be in Unix time.

How you arrive at that figure can be from a variety of methods. Simply putting in the Unix Time for "about now" (when I typed this post) which is 1754246631 seconds since Jan 01 1970, will make a calendar event for that time.

To enter the time as a Function directly in the Action Field you can do something like this:

TIME(2025,8,6,11,0,0)-GMTOFFSET()

The numbers in the brackets represent:
Year,Month,Day,Hour,Minute,Seconds and all have to have a value even if it is zero.

This example would create an event on 2025, August, 6th, 11am at your local time.

And those numbers can be represented by Variables. So, if for example, you set the Variable Local_Year to 2025 in your Macro you could write the formula as:

TIME(Local_Year,8,6,11,0,0)-GMTOFFSET()

1 Like

YEAR(2025) will not be doing anything close to useful.

The YEAR function gets you the year of the unixtime of 2025, which is going to be 1970.

You want just TIME(2025,8,9+1,9,0,0)

2 Likes

Hi @peternlewis
Is the request to have this action go to the newly created event in Calendar likely it to make to the next release? This is potentially a very useful action but after creating a new event at the moment, we have to manually search to find it in the Calendar App.

What request?

No?

The action creates the entry, it is not displayed.

It was something I asked before and you replied that it was noted :grinning:

this helped the most. Thank you.

oh i didn't know we could put variable there as "Local_Year" instead of "%Variable%Local_Year%".

Thanks for the comprehensive answer. It helps.

1 Like

Ahh, ok, yes, that is on the wishlist. Not sure that will ever get done, but it's on the list.

1 Like

In the meantime you could spoof it with the following AppleScript placed after the "Create Calendar Event" action:

-- Set calendar name
set theCalName to "Automator"

tell application "Calendar"
	set theCal to item 1 of (get every calendar whose name is theCalName)
	tell theCal to show item 1 of (every event whose stamp date is greater than ((current date) - 1 * minutes))
end tell
end

Set the name in line 2, currently "Automator", to the name of the calendar referenced in the action.

This will break if you create more than one event in the same minute -- slow down, you crazy calendar filler! -- and may need finessing if you have multiple accounts in Calendar etc. And I don't know what performance will be like if you have lots of events in that calendar.

Not (unfortunately) a Calendar user, so there may be other gotchas.

Thank you @Nige_S - it is a good idea and I have tried myself in the past, to find an AppleScript solution to the event not opening after the Action has run. Unfortunately your AppleScript on my Mac just causes Calendar to crash...

Until the native Keyboard Maestro Action can open the new event I will continue to use AppleScript to make the event and open it - which does work.

1 Like

I wonder if, unlike me, you have enough events in that calendar that the script barfs when filtering them all...

1 Like

I think that's probably it - is the AppleScript looking at all the events in a particular Calendar and getting the latest one? I have thousands of events in my Calendar.

Currently, to create new Calendar events I'm using a variation of this Macro by @Jim

It works well and ends with the simple command "show newEvent". But I couldn't adapt that AppleScript command to work to open a new event created by the native Keyboard Maestro Action.