diff --git a/README.md b/README.md index 2793983..68f1b96 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ https://en.wikipedia.org/wiki/Discordian_calendar Discordian time is the decimal time without time zones, where the beginning of the day coincides with the beginning of the Christian winter day on Easter Island (UTC-5): -https://en.wikipedia.org/wiki/Decimal_time +https://discordia.fandom.com/wiki/Erisian_Time \ No newline at end of file diff --git a/dtime.js b/dtime.js index 3fb8991..e323c27 100644 --- a/dtime.js +++ b/dtime.js @@ -92,17 +92,15 @@ function dtime(gregorianDate,resultar="default") { } else { var ddatestr = M+" "+az(D)+", "+Y+" YOLD"; } - var h = date.getUTCHours(); - var m = date.getUTCMinutes(); - var s = date.getUTCSeconds(); - var ms = date.getUTCMilliseconds(); - var e = h*3600000+m*60000+s*1000+ms; - var ds = Math.round(e/864); - h = Math.floor(ds/10000); + + var christianMSDay = date.valueOf() % 86400000; + var ds = (1 / (864 / christianMSDay)); + var h = Math.floor(ds/10000); ds%= 10000; - m = Math.floor(ds/100); + var m = Math.floor(ds/100); ds%= 100; - s = ds; + var s = Math.floor(ds); + switch (resultar) { case "shortsec": return [ddatestr, h+":"+az(m), ":"+az(s), ddaystr];