21 lines
414 B
C#
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;
|
|
}
|
|
}
|
|
|
|
} |