How can i stop a delete trigger after a specific time?

Hi there, i have a situation where my database has some transactions that needs to be deleted, the only problem is that i need to delete these transactions only between 12am and 6am.
If the trigger is runnin, the transactions are being deleted, and the clock hits 6am this trigger needs to be immediately stopped. Does anyone have a idea how can i make that?
Some have suggested to use .maxTimeMS() but it returns a error when using it in my delete command.
Putting the interval in the cron job ( 0 0-6 * * * ) does not help much because it does not interrupt the trigger if it starts before the schedule end time.
I appreciate any help and i can provide further info if necessary.