mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
23 lines
463 B
C#
23 lines
463 B
C#
using System;
|
|
using Cronos;
|
|
|
|
namespace Kavita.Common.Helpers;
|
|
|
|
public static class CronHelper
|
|
{
|
|
public static bool IsValidCron(string cronExpression)
|
|
{
|
|
// NOTE: This must match Hangfire's underlying cron system. Hangfire is unique
|
|
try
|
|
{
|
|
CronExpression.Parse(cronExpression);
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
/* Swallow */
|
|
return false;
|
|
}
|
|
}
|
|
}
|