No commit activity in last 3 years
No release in over 3 years
The gem give the ability to use the French republican (French revolutionary) calendar.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.5
>= 0
 Project Readme

RepublicanCalendar

The gem give the ability to use the French republican (French revolutionary) calendar.

This calendar was used from the 22 september 1792 until the first of january 1806 in France.

The calendar is accurate between these two dates.

Although it's kind of nonsense of using the calendar after the 01-01-1806, there's a debate on how dates would have been calculated. I choose to stop using sextil years after 1803 (year 11) and use leap years. Some will think it's not accurate, but who really needs a revolutionary date after 1806 ?

Installation

Add this line to your application's Gemfile:

gem 'republican_calendar', git: 'https://github.com/4nt1/republican_calendar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install republican_calendar

Usage

The gem offers a new class Date::Republican to represent a given moment from the start of the first french republic.

# first day of the republic
Date::Republican.new
=> #<Date::Republican:0x007fb765185870 @day=1, @month=1, @year=1>

# a republican date before the 22-09-1792 is invalid
Date::Republican.new(-1, 1, 1)
=> ArgumentError: invalid date no year 0 in the republican calendar

# Coup of 18 brumaire
Date.new(1799, 11, 9).to_republican.to_s
=> "18 Brumaire an 8"

# Make new Date::Republican from numeric or string values
Date::Republican.parse("18 Brumaire an 8")
=> #<Date::Republican:0x007ffae1514b20 @day=18, @month=2, @year=8>

Date::Republican.new(8, 2, 18).to_s
=> "18 Brumaire an 8"

# Make the conversion in both ways (from Date to Date::Republican and vice versa)
Date.new(1799, 11, 9).to_republican.to_gregorian
=> #<Date: 1799-11-09 ((2378444j,0s,0n),+0s,2299161j)>

# Add or substract days
Date::Republican.new + 200
=> #<Date::Republican:0x007f9e4ba5c0d0 @day=21, @month=7, @year=1>

# Check if a republican year is sextil
Date::Republican.new(3).sextil?
=> true

# Date::Republican includes Comparable
Date::Republican.new(4, 1, 1) > Date::Republican.new(4, 1, 2)
=> false

TODO

Improve the Date::Republican#strftime method (actually a simple #to_s).

Contributing

  1. Fork it ( http://github.com//republican_calendar/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request