Azure Functions – TimerTrigger – get next scheduled occurrence

Is there a way to get the next scheduled occurrence of an Azure Timer function? This issue seems to say that TimerInfo should have a schedule property, but I’m not seeing it in .NET 8.

https://github.com/Azure/azure-functions-dotnet-worker/issues/954#issuecomment-1238433441

public static void CronJob([TimerTrigger("*/15 * * * * *")] TimerInfo timerInfo)
{
    var schedule = timerInfo.Schedule as CronSchedule;
    var next = schedule.GetNextOccurrence(DateTime.UtcNow);

    . . .
}

Is the GetNextOccurrence ability just gone now? Is there any workaround?

(Cross Posted: https://github.com/Azure/azure-functions-dotnet-worker/discussions/2204)

Leave a Comment