A .NET library providing DateTimeRange, Business Day calculations, and comprehensive extension methods for DateTime, DateTimeOffset, and TimeSpan.
Exceptionless.DateTimeExtensions is a .NET library that provides a comprehensive set of utilities for working with dates and times. It solves common problems like parsing complex date ranges, calculating business days, and performing timezone-aware operations through intuitive extension methods and classes.
.NET developers building applications that require robust date and time manipulation, such as scheduling systems, reporting tools, or any software with business logic dependent on temporal calculations.
Developers choose this library for its production-ready implementation of Elasticsearch-style date math parsing, comprehensive extension methods that reduce boilerplate code, and reliable handling of business day calculations and timezone-aware operations.
DateTimeRange, Business Day and various DateTime, DateTimeOffset, TimeSpan extension methods
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports full Elasticsearch-style date math syntax with timezone-aware operations and rounding control, as detailed in the README's examples like 'now-1d/d' and '2025-01-01T01:25:35Z||+3d/d'. This makes it ideal for integrating with Elasticsearch or similar systems.
Provides a BusinessDay class for custom business hours and day checks, reducing boilerplate code for scheduling applications, as shown in the sample code that validates datetimes against defined business windows.
Includes extensive helper methods for DateTime, DateTimeOffset, and TimeSpan, such as StartOfDay, EndOfMonth, and ToApproximateAgeString, simplifying common temporal operations without manual calculations.
Parses strings like '1h' or '30m' into TimeSpan objects via the TimeUnit class, enhancing code readability for time-based logic, as demonstrated in the README with examples from nanoseconds to days.
Mastering Elasticsearch's date math syntax and rounding behavior with inclusive/exclusive boundaries requires familiarity with Elasticsearch conventions, which can be non-intuitive and error-prone for developers new to it.
The library is built around the Gregorian calendar and lacks mention of support for other calendars or cultural date formats, restricting its use in international or multi-cultural applications.
Parsing dynamic expressions and creating range objects introduces runtime overhead compared to using native .NET methods for simple date arithmetic, which may not be suitable for performance-critical scenarios.
While unit tests provide examples, the README relies heavily on linking to source code for extension method details, which can make it harder for developers to quickly grasp all available features without digging into the codebase.