IsWithin() for DateRange
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user