Need to know the cron trigger time in the worker runtime
Is there a simple/canonical way to get the time that a cron was scheduled to run at runtime? Not its recurring schedule but an instance. For example if I ask for daily at 11:59:59, a way for the code that executes to know that the current time it was scheduled to start on was the previous day, even though Date.now() is going to say its the day after naturally.
1 Reply
ah there is https://developers.cloudflare.com/workers/runtime-apis/handlers/scheduled/#properties event.scheduledTime
Scheduled Handler · Cloudflare Workers docs
When a Worker is invoked via a Cron Trigger, the scheduled() handler handles the invocation.