A robust Calendar Versioning implementation for .NET with full support for parsing, comparison, and format customization.
Install via NuGet Package Manager:
dotnet add package tetri.net.CalendarVersioningOr add directly to your .csproj:
<PackageReference Include="tetri.net.CalendarVersioning" Version="1.0.0" />// From string
var version = CalendarVersion.Parse("2025.04.29");
// With custom format (YY.MM.Minor)
var format = new CalendarVersionFormat("YY.MM.Minor");
var custom = CalendarVersion.Parse("25.04.1", format);
// Using constructor
var version = new CalendarVersion(year: 2025, month: 4, day: 29, minor: 1);var v1 = CalendarVersion.Parse("2025.04");
var v2 = CalendarVersion.Parse("2025.05");
if (v1 < v2)
{
Console.WriteLine($"{v1} is earlier than {v2}");
}// Equality
bool equal = v1 == v2;
// Comparison
bool greater = v1 > v2;
// Comparison methods
int result = v1.CompareTo(v2);β
Strict Calendar Version parsing with format validation
β
Full version comparison support
β
Custom formats (YYYY.MM, YY.MM.DD.Minor, etc)
β
Overloaded operators (==, !=, <, >, <=, >=)
β
Immutable and thread-safe
β
JSON/XML serialization ready
var format = new CalendarVersionFormat("YYYY.MM.Minor");
var version = CalendarVersion.Parse("2025.04.2", format);
Console.WriteLine(version.Year); // 2025
Console.WriteLine(version.Month); // 4
Console.WriteLine(version.Minor); // 2var stable = CalendarVersion.Parse("2025.04.15");
var hotfix = CalendarVersion.Parse("2025.04.15.1");
Console.WriteLine(hotfix > stable); // TrueWe welcome contributions! Please follow these steps:
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Crafted with π§ by Tetri Mesquita