Sinistrius.CalendrierRepublicain 1.0.0

dotnet add package Sinistrius.CalendrierRepublicain --version 1.0.0                
NuGet\Install-Package Sinistrius.CalendrierRepublicain -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sinistrius.CalendrierRepublicain" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sinistrius.CalendrierRepublicain --version 1.0.0                
#r "nuget: Sinistrius.CalendrierRepublicain, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sinistrius.CalendrierRepublicain as a Cake Addin
#addin nuget:?package=Sinistrius.CalendrierRepublicain&version=1.0.0

// Install Sinistrius.CalendrierRepublicain as a Cake Tool
#tool nuget:?package=Sinistrius.CalendrierRepublicain&version=1.0.0                

Sinistrius.CalendrierRepublicain

A .NET library which integrates the French Republican calendar

Installation

Use the NuGet package manager to install the package.

Usage

Restrictions

The library sticks with the features that were officially adopted in France between 1 Vendémiaire I (i.e. September 22, 1792) and 10 Nivôse XIV (i.e. December 31, 1805). It therefore doesn't work for dates beyond that validity period, and likewise it doesn't support decimal time.

Creating Dates

Instantiate a DateTime object with Republican date values using the calendar object:

using Sinistrius.CalendrierRepublicain;

FrenchRepublicanCalendar() repCalendar = new();
DateTime date = new(8, 2, 18, repCalendar);
Console.WriteLine(date.ToString("d", DateTimeFormatInfo.InvariantInfo));
// Displays 11/9/1799

Writing Dates

Get a string representation of a Republican date by using the String.Format() method with a format provider and format string. Please note that only a few date and time patterns are supported.

using Sinistrius.CalendrierRepublicain;

FrenchRepublicanDateTimeFormatter provider = new();
DateTime date = new(8, 2, 18, repCalendar);

Console.WriteLine(String.Format(provider, "{0:D}", date));
// Displays Octidi, Brumaire 18, VIII

Console.WriteLine(String.Format(provider, "{0:d MMM. 'an' yyyy}", date));
// Displays 18 Brum. an VIII

Working with the Calendar

The FrenchRepublicanCalendar class is derived from System.Globalization.Calendar and provides the same functionality.

using Sinistrius.CalendrierRepublicain;

FrenchRepublicanCalendar calendar = new();
FrenchRepublicanDateTimeFormatter provider = new();

DateTime date = new(8, 2, 18, calendar);  // 18 Brumaire VIII
int weeks = 4;                            // 4 Republican weeks (40 days) to add

date = calendar.AddWeeks(date, weeks);
Console.WriteLine(String.Format(provider, "{0:d MMMM yyyy}", date));
// Displays 28 Frimaire VIII

License

This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 242 3/12/2023
0.1.0 210 3/5/2023