public DateRangeValue ToDateRange(DateTimeOffset now) { DateTimeOffset fromDate; switch (PeriodType) { case PeriodType.Days: fromDate = now.AddDays(-1 * Value); break; case PeriodType.Weeks: fromDate = now.AddDays(-1 * 7 * Value); break; case PeriodType.Months: fromDate = now.AddMonths(-1 * Value); break; } return(DateRangeValue.Create(fromDate, now)); }
public bool IsBetween(DateRangeValue dateRange) { return(Value >= dateRange.From && Value <= dateRange.To); }
protected bool Equals(DateRangeValue other) { return(From.Equals(other.From) && To.Equals(other.To)); }