IsWithin() for DateRange

This commit is contained in:
2021-08-18 12:39:01 +02:00
parent 56ac9ea0c4
commit fd6c544786
+13
View File
@@ -7,5 +7,18 @@ namespace zero.Core.Entities
public DateTimeOffset? From { get; set; }
public DateTimeOffset? To { get; set; }
public bool IsWithin(DateTimeOffset date)
{
if (From.HasValue && date < From)
{
return false;
}
if (To.HasValue && date > To)
{
return false;
}
return true;
}
}
}