Wait
Wait until
Wait until a date, then continue execution.
This example sends a reminder email to a user at the specified datetime.
/trigger/reminder-email.ts
This allows you to write linear code without having to worry about the complexity of scheduling or managing CRON jobs.
In the Trigger.dev Cloud we automatically pause execution of tasks when they are waiting for longer than a few seconds. You are not charged when execution is paused.
throwIfInThePast
You can optionally throw an error if the date is already in the past when the function is called:
You can of course use try/catch if you want to do something special in this case.
Was this page helpful?