Skip to content

carlosfrodrigues/discordian-calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discordian Calendar Hex.pm

An implementation of the Discordian Calendar built using the Elixir Calendar behaviour

Usage

You can create a Date in Gregorian Calendar and convert it to Discordian Calendar:

{:ok, date} = Date.new(2020, 12, 3, Calendar.ISO)
{:ok, ~D[2020-12-03]}
{:ok, dicord_date} = Date.convert(date, Discordian.Calendar)
{:ok, ~D[3186-05-45 Discordian.Calendar]}

Or you can convert from discordian to gregorian:

{:ok, discord} = Date.new(3166, 1, 60, Discordian.Calendar)
{:ok, ~D[3166-01-60 Discordian.Calendar]}
{:ok, date} = Date.convert(discord, Calendar.ISO)
{:ok, ~D[2000-03-01]}

St. Tib's day

St. Tib's day is an extra day that doesn't count and is equivalent to the February 29 in a leap year. Because it is between the Chaos 59 and Chaos 60 I put it representation as month 6 and day 6. So, for example, in the year 3166(equivalent to 2000 in the gregorian calendar) the St. Tib's day is 6-6-3166 and it's between 1-59-3166 and 1-60-3166. The discordian calendar has only five months so this day in month 6 doesn't mess up with the whole calendar.

Installation

This package is available in Hex, it can be installed by adding discordian to your list of dependencies in mix.exs:

def deps do
  [
    {:discordian, "~> 0.1.0"}
  ]
end