GithubHelp home page GithubHelp logo

revcal's Introduction

Revcal

This is a Go rewrite of a Ruby library that started with the work of Jonathan Badger (GitHub source). The original source code comments, Usage and Algorithm documentation are only slightly modified to conform to Go verbage.

Usage

The script "revcal" without any arguments returns the current date in the revolutionary calendar, along with the associated concept for the day. Providing a date (in the standard ISO 8601 date format that the time package can parse), returns the value for that date instead (which is useful for looking up one's birthday, for instance.)

 ./revcal 2021-01-02
Today is 13 Nivôse 229 celebrating the Ardoise (Slate).
./revcal
Today is 26 Thermidor 229 celebrating the Myrte (Myrtle).

revcal is a script that converts standard Gregorian dates into those used by the French Republican Calendar. This was the calendar used by the Republican government in France between 1793 and 1805. Its structure reflects the secular, rational ideals of the time, with 12 months of a uniform 30 days, broken into 3 10-day "weeks". The remaining five days of the year (or 6 in leap years) were filled with monthless year-end celebrations. Year 1 of the calendar started in September 1792, with the official founding of the French Republic. Each day of the year was associated with a plant, animal, or tool, replacing the saints of Catholic tradition.

Algorithm

The arithmetic of the date package is used to calculate the number of days since September 22, 1792 (Day 1 of Year 1). Then it is a simple matter of jumping forward by the number of days in each year until the number of remaining days is less than a length of a year. Then dividing this number by 30 gives the month, and the modulo the day. The only real issue is what counts as a leap year. There are several conflicting ideas as to the method of computing the revolutionary leap years. The chosen method is to treat the historical leap years as 3, 7, 11, 15, and 20, and to treat subsequent years divisible by 4 that aren't divisible by 100 (unless they are also divisible by 400), as per the Gregorian method.

There are several Go tests to confirm conversion of famous dates such as 18 Brumaire 8 (Nov 27, 1799; the date of Napoleon Bonaparte's coup against the French Directory, effectively killing the revolution as an ideological movement), the rise of the July Monarchy in 1830, as well as the return of the Bonaparte dynasty for one last time in 1851 with the rise of Napolean III.

Other notes

revcal's People

Contributors

jocmp avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.