public static void ForPrecedesDate(CompoundDateTimeService value, CompoundDateTimeService dateToPrecede, string parameterName) { if (value.DateTime >= dateToPrecede.DateTime) { throw new ArgumentOutOfRangeException(parameterName); } if (value.PersianDateTime >= dateToPrecede.PersianDateTime) { throw new ArgumentOutOfRangeException(parameterName); } }
public static DateTimeRange CreateOneWeekRange(CompoundDateTimeService startDay) => new DateTimeRange(startDay, new CompoundDateTimeService(startDay.DateTime.AddDays(7)));
public static DateTimeRange CreateOneDayRange(CompoundDateTimeService day) => new DateTimeRange(day, new CompoundDateTimeService(day.DateTime.AddDays(1)));
public DateTimeRange NewStart(CompoundDateTimeService newStart) => new DateTimeRange(newStart, this.End);
public DateTimeRange NewEnd(CompoundDateTimeService newEnd) => new DateTimeRange(this.Start, newEnd);
public DateTimeRange(CompoundDateTimeService start, TimeSpan duration) : this(start, start.Add(duration)) { }
public DateTimeRange(CompoundDateTimeService start, CompoundDateTimeService end) { DateTimeGuard.ForPrecedesDate(start.DateTime, end.DateTime, "start"); Start = start; End = end; }