/// <summary> /// Returns the <see cref="DateRange"/> representation from a given string. /// <para>String representations of dates are always expressed in Coordinated Universal Time(UTC)</para> /// </summary> /// <exception cref="FormatException" /> public static DateRange Parse(string value) { var match = MultipleBoundariesRegex.Match(value); if (!match.Success) { return(new DateRange(DateRangeBound.Parse(value))); } return(new DateRange( DateRangeBound.Parse(match.Groups[1].Value), DateRangeBound.ParseUpperBound(match.Groups[2].Value))); }
/// <summary> /// Creates a new instance of <see cref="DateRange"/> using a lower bound and an upper bound. /// <para>Consider using <see cref="Parse(string)"/> to create instances more easily.</para> /// </summary> /// <param name="lowerBound"> /// A value representing the range lower bound, composed by a /// <c>DateTimeOffset</c> and a precision. Use <see cref="DateRangeBound.Unbounded"/> for an open lower bound. /// </param> public DateRange(DateRangeBound lowerBound) : this() { LowerBound = lowerBound; }
/// <summary> /// Creates a new instance of <see cref="DateRange"/> using a lower bound and an upper bound. /// <para>Consider using <see cref="Parse(string)"/> to create instances more easily.</para> /// </summary> /// <param name="lowerBound"> /// A value representing the range lower bound, composed by a /// <c>DateTimeOffset</c> and a precision. Use <see cref="DateRangeBound.Unbounded"/> for an open lower bound. /// </param> /// <param name="upperBound"> /// A value representing the range upper bound, composed by a /// <c>DateTimeOffset</c> and a precision. Use <see cref="DateRangeBound.Unbounded"/> for an open higher bound. /// </param> public DateRange(DateRangeBound lowerBound, DateRangeBound upperBound) : this(lowerBound) { UpperBound = upperBound; }