---
title: DateRangeExtensions
summary: API reference for DateRangeExtensions.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
---

# DateRangeExtensions

The library's date-range algorithm surface: equality, open-endedness, overlap and contiguity testing, and range filtering, operating on `IDateRange`/`IEnumerable<IDateRange>`. ([BR-001](../../business-rules.md#br-001-a-date-range-is-valid-only-when-begindate-is-less-than-or-equal-to-enddate), [BR-003](../../business-rules.md#br-003-two-ranges-with-identical-begin-and-end-dates-overlap-only-when-they-are-not-a-single-day), [BR-004](../../business-rules.md#br-004-whether-shared-endpoints-count-as-an-overlap-is-caller-selectable), [BR-005](../../business-rules.md#br-005-a-set-of-fewer-than-two-date-ranges-is-always-contiguous)) through [BR-011](../../business-rules.md#br-011-the-default-collection-overlap-mode-is-datesmaynotmatch), [BR-034](../../business-rules.md#br-034-two-date-ranges-are-equal-if-and-only-if-both-begindate-and-enddate-match), [BR-036](../../business-rules.md#br-036-the-default-date-in-range-inclusivity-is-firstonly-%E2%80%94-begin-date-inclusive%2C-end-date-exclusive), [BR-037](../../business-rules.md#br-037-a-null-date-is-never-in-range)

## Purpose
- The library's date-range algorithm surface: equality, open-endedness, overlap and contiguity testing, and range filtering, operating on `IDateRange`/`IEnumerable<IDateRange>`. ([BR-001](../../business-rules.md#br-001-a-date-range-is-valid-only-when-begindate-is-less-than-or-equal-to-enddate), [BR-003](../../business-rules.md#br-003-two-ranges-with-identical-begin-and-end-dates-overlap-only-when-they-are-not-a-single-day), [BR-004](../../business-rules.md#br-004-whether-shared-endpoints-count-as-an-overlap-is-caller-selectable), [BR-005](../../business-rules.md#br-005-a-set-of-fewer-than-two-date-ranges-is-always-contiguous)) through [BR-011](../../business-rules.md#br-011-the-default-collection-overlap-mode-is-datesmaynotmatch), [BR-034](../../business-rules.md#br-034-two-date-ranges-are-equal-if-and-only-if-both-begindate-and-enddate-match), [BR-036](../../business-rules.md#br-036-the-default-date-in-range-inclusivity-is-firstonly-%E2%80%94-begin-date-inclusive%2C-end-date-exclusive), [BR-037](../../business-rules.md#br-037-a-null-date-is-never-in-range)

## Context
- Namespace: `SAIF.Common.Extensions`
- Assembly/package: `SAIF.Framework.Common`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| IsEqual(this IDateRange source, IDateRange other) | `public static bool IsEqual(this IDateRange source, IDateRange other)` | Value-equality check between two ranges. ([BR-034](../../business-rules.md#br-034-two-date-ranges-are-equal-if-and-only-if-both-begindate-and-enddate-match)) |
| IsOpenEnded(this IDateRange source) | `public static bool IsOpenEnded(this IDateRange source)` | True when the range's end date is a max/sentinel value indicating no defined end. |
| IsOverlapping(this IDateRange source, IDateRange other, OverlappingDateOptions options) | `public static bool IsOverlapping(this IDateRange source, IDateRange other, OverlappingDateOptions options)` | Tests two ranges for overlap, honoring whether shared boundary dates count as overlapping. ([BR-004](../../business-rules.md#br-004-whether-shared-endpoints-count-as-an-overlap-is-caller-selectable)) |
| IsValidRange(this IDateRange source) | `public static bool IsValidRange(this IDateRange source)` | True when `BeginDate <= EndDate`. |
| IsFutureRange(this IDateRange source) | `public static bool IsFutureRange(this IDateRange source)` | True when the entire range lies in the future. |
| IsPastRange(this IDateRange source) | `public static bool IsPastRange(this IDateRange source)` | True when the entire range lies in the past. |
| IsInRange(this DateTime date, IDateRange range) | `public static bool IsInRange(this DateTime date, IDateRange range)` | True when `date` falls within the range's boundaries, inclusive. ([BR-036](../../business-rules.md#br-036-the-default-date-in-range-inclusivity-is-firstonly-%E2%80%94-begin-date-inclusive%2C-end-date-exclusive), [BR-037](../../business-rules.md#br-037-a-null-date-is-never-in-range)) |
| IsInRange(this IDateRange source, IDateRange other) | `public static bool IsInRange(this IDateRange source, IDateRange other)` | True when `source` falls entirely within `other`. |
| AsOf<T>(this IEnumerable<T> source, DateTime asOfDate) | `public static IEnumerable<T> AsOf<T>(this IEnumerable<T> source, DateTime asOfDate) where T : IDateRange` | Filters a collection of ranges to those effective as of `asOfDate`. |
| ContainsDateRange(this IEnumerable<IDateRange> source, IDateRange target) | `public static bool ContainsDateRange(this IEnumerable<IDateRange> source, IDateRange target)` | True when any range in the collection matches `target` exactly. |
| ContainsBeginDate(this IEnumerable<IDateRange> source, DateTime beginDate) | `public static bool ContainsBeginDate(this IEnumerable<IDateRange> source, DateTime beginDate)` | True when any range in the collection has the given `BeginDate`. |
| IsContiguous(this IEnumerable<IDateRange> source, ContiguousOptions options) | `public static bool IsContiguous(this IEnumerable<IDateRange> source, ContiguousOptions options)` | Tests whether an ordered sequence of ranges forms an unbroken (or gap-tolerant, per `options`) chain. ([BR-005](../../business-rules.md#br-005-a-set-of-fewer-than-two-date-ranges-is-always-contiguous), [BR-006](../../business-rules.md#br-006-contiguity-is-evaluated-on-ranges-sorted-ascending-by-begindate%2C-and-fails-on-the-first-violating-pair), [BR-007](../../business-rules.md#br-007-the-default-contiguity-mode-is-startisnextday)) |
| IsOverLapping(this IEnumerable<IDateRange> source) | `public static bool IsOverLapping(this IEnumerable<IDateRange> source)` | Tests whether any two ranges within the collection overlap each other. ([BR-008](../../business-rules.md#br-008-a-set-of-fewer-than-two-date-ranges-never-self-overlaps), [BR-009](../../business-rules.md#br-009-a-range-whose-begin-and-end-are-both-sentinel-values-is-treated-as-a-null-date-and-ignored-during-collection-overlap-evaluation), [BR-010](../../business-rules.md#br-010-an-open-ended-predecessor-followed-by-any-range-with-a-real-begin-date-is-always-an-overlap), [BR-011](../../business-rules.md#br-011-the-default-collection-overlap-mode-is-datesmaynotmatch)) |


## Sources
- `Common/SAIF.Common/Extensions/DateRangeExtensions.cs`
