Files
2025-01-05 19:43:30 -05:00

21 lines
414 B
C#

namespace YongeStreet.Controllers;
public static class Util
{
public static DateOnly? ParseDateOnly(string? date)
{
if (string.IsNullOrEmpty(date))
{
return new DateOnly(2025, 1, 1);
}
try
{
return DateOnly.ParseExact(date, "yyyy-MM-dd");
}
catch (FormatException e)
{
return null;
}
}
}