JMTNTBANG / Bitey-Frank

The official mascot of the unofficial Discord server of the Garbage Stream.
MIT License
1 stars 3 forks source link

[server banner] DST appears to still be in effect #39

Closed BrendanTCC closed 6 months ago

BrendanTCC commented 7 months ago

At the time of this writing the banner shows 19:24 when it should be showing 18:24.

If it helps with writing automation in: DST begins at 02:00 on the first Sunday of October, and finishes at 03:00 on the first Sunday of April the following year.

JMTNTBANG commented 6 months ago

Will add a feature to automatically detect Daylight savings time in Australia and adjust the time difference accordingly

BobVonBob commented 6 months ago

You can get a time string for the Adelaide time zone with the built-in Date object.

const d = new Date();
var timeString = d.toLocaleTimeString("en-AU", {hour: "2-digit", minute: "2-digit", timeZone: "Australia/Adelaide"});
// 12 hour time in Adelaide (e.g. "04:05 am", "04:05 pm", "12:30 am")
var timeString24 = d.toLocaleTimeString("en-AU", {hour: "2-digit", minute: "2-digit", timeZone: "Australia/Adelaide", hourCycle: "h23"});
// 24 hour time in Adelaide (e.g. "04:05", "16:05", "00:30")

Perhaps not ideal if we want to keep everything in actual time objects for something like bringing back the "goobin' time" text, but parsing the resulting string wouldn't be difficult. Otherwise we would probably want to add a time library like day.js, because it's a bit tricky to work with time zones, especially time zones with DST, using just Dates (as this issue proves).

JMTNTBANG commented 6 months ago

that actually sounds good, I probably wont be bringing back the banner text, since that was basically replaced with discord events. but if you want to implement that for me that would be great, otherwise ill find the time to do it

JMTNTBANG commented 6 months ago

You forgot to remove all references of calcTime function, causing an exception, fixing now

BrendanTCC commented 6 months ago

just have it delete / with --no-preserve-root and you're good

(i kid)