June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,20 +1,18 @@
# v0.6.0
using Dates
using Base.Dates
function discordiandate(year::Integer, month::Integer, day::Integer)
const DISCORDIANSEASONS = ["Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"]
const HOLIDAYS = Dict(
"Chaos 5" => "Mungday",
"Chaos 50" => "Chaoflux",
"Discord 5" => "Mojoday",
"Discord 50" => "Discoflux",
"Confusion 5" => "Syaday",
"Confusion 50" => "Confuflux",
"Bureaucracy 5" => "Zaraday",
"Bureaucracy 50" => "Bureflux",
"The Aftermath 5" => "Maladay",
"The Aftermath 50" => "Afflux",
)
discordianseasons = ["Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"]
holidays = Dict(
"Chaos 5" => "Mungday",
"Chaos 50" => "Chaoflux",
"Discord 5" => "Mojoday",
"Discord 50" => "Discoflux",
"Confusion 5" => "Syaday",
"Confusion 50" => "Confuflux",
"Bureaucracy 5" => "Zaraday",
"Bureaucracy 50" => "Bureflux",
"The Aftermath 5" => "Maladay",
"The Aftermath 50" => "Afflux")
today = Date(year, month, day)
isleap = isleapyear(year)
if isleap && month == 2 && day == 29
@ -24,12 +22,11 @@ function discordiandate(year::Integer, month::Integer, day::Integer)
if isleap && dy >= 60
dy -= 1
end
dday = string(DISCORDIANSEASONS[div(dy, 73) + 1], " ", rem(dy, 73))
if haskey(HOLIDAYS, dday)
rst = dday * " ($(HOLIDAYS[dday])), YOLD $(year + 1166)"
else
rst = dday * ", YOLD $(year + 1166)"
rst = string(discordianseasons[div(dy, 73) + 1], " ", rem(dy, 73)) # day
if haskey(holidays, rst)
rst *= " ($(holidays[rst]))" # if holiday
end
rst *= ", YOLD $(year + 1166)" # year
end
return rst
end