DateTimeCache
A lightweight C# library that provides a lean and fast cache object that provides access to date and time related values that are expensive to calculate, like business hours in a week, month or year, weekdays in a week, month or year, first monday of month, first weekday of month et cetera. It also provides a clear separation between ordinal (year and month) and ISO 8601 week numbers and their differing bounds. It is geared towards supporting planning and scheduling type scenarios where it is needed to have a clear and performant grip on date ranges and all kinds of values like days, hours, holidays.
📄 Source
✨ Features
- High-Performance Caching: Caches expensive date and time calculations for rapid retrieval.
- Business Hours Calculation: Determines the number of business hours in a given week, month, or year.
- Weekday Calculation: Calculates the number of weekdays within a specific week, month, or year.
- First Day of Month Calculation: Easily find the first occurrence of a specific weekday in a month (e.g., the first Monday).
- ISO 8601 Week Support: Provides clear and distinct handling of ISO 8601 week numbers and their boundaries.
- Ordinal Date System Support: Works seamlessly with standard year, month, and day numbering.
- Date Range Operations: Offers performant and intuitive control over date ranges.
- Holiday Tracking: Includes capabilities for managing holidays and non-working days.
- Optimized for Scheduling: Specifically designed to support planning and scheduling applications.
- Lightweight and Lean: A minimal library with a small footprint, focused on performance.
- Accurate Week Boundary Detection: Differentiates between ordinal and ISO 8601 week definitions to avoid common off-by-one errors.
- Flexible Time Value Access: Provides a strong grip on various time-based values like days, hours, and custom-defined periods.
- AOT compatible: The library is AOT compatible and trimmable
🖥️ Requirements
| Requirement | Version |
|---|---|
| OS | Windows 10 / 11 (x64) |
| Runtime | .NET 10 Desktop Runtime |
🚀 Getting Started
NuGet
PM> Install-Package DateTimeCache
or
dotnet add package DateTimeCache --version 1.1.0
Manual download
- Download the latest version from the Releases page.
- Add a reference to DateTimeCache.dll to your project.
🤝 Contributing
Contributions are welcome! Please open an issue first to discuss what you would like to change, then submit a pull request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
📄 License
Distributed under the Creative Commons CC0 1.0 Universal License. See License for details.
