Skip to content

tetri/CalendarVersioning

Repository files navigation

CalendarVersioning

NuGet Version NuGet Downloads License Github Build Status AppVeyor Build Status

A robust Calendar Versioning implementation for .NET with full support for parsing, comparison, and format customization.

πŸ“¦ Installation

Install via NuGet Package Manager:

dotnet add package tetri.net.CalendarVersioning

Or add directly to your .csproj:

<PackageReference Include="tetri.net.CalendarVersioning" Version="1.0.0" />

πŸš€ Quick Start

Creating versions

// 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);

Comparing versions

var v1 = CalendarVersion.Parse("2025.04");
var v2 = CalendarVersion.Parse("2025.05");

if (v1 < v2) 
{
    Console.WriteLine($"{v1} is earlier than {v2}");
}

Supported operations

// Equality
bool equal = v1 == v2; 

// Comparison
bool greater = v1 > v2;

// Comparison methods
int result = v1.CompareTo(v2);

✨ Features

βœ… 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

πŸ“š Advanced Examples

Custom format parsing

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); // 2

Comparing detailed versions

var stable = CalendarVersion.Parse("2025.04.15");
var hotfix = CalendarVersion.Parse("2025.04.15.1");

Console.WriteLine(hotfix > stable); // True

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Crafted with 🧠 by Tetri Mesquita

About

A robust Calendar Versioning implementation for .NET with full support for parsing, comparison, and format customization.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages