From 9d7f8888a7253a01997ae3ceef2875556c0b760e Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 13 Oct 2026 21:59:49 +1300 Subject: [PATCH] Fix scheduled event tests --- src/d2m/converters/message-to-event.js | 4 ++-- src/d2m/converters/message-to-event.test.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d2m/converters/message-to-event.js b/src/d2m/converters/message-to-event.js index 4314a0e..45d9746 100644 --- a/src/d2m/converters/message-to-event.js +++ b/src/d2m/converters/message-to-event.js @@ -915,8 +915,8 @@ async function messageToEvent(message, guild, options = {}, di) { // Add time if (event.scheduled_end_time) { - const formatter = new Intl.DateTimeFormat("en-NZ", {month: "long", day: "numeric", hour: "numeric", minute: "2-digit", timeZoneName: "shortGeneric", timeZone: reg.ooye.time_zone}) // 9 June at 3:00 pm NZT - var displayTime = formatter.formatRange(new Date(event.scheduled_start_time), new Date(event.scheduled_end_time)) + const formatter = new Intl.DateTimeFormat("en-NZ", {weekday: "long", month: "long", day: "numeric", hour: "numeric", minute: "2-digit", timeZone: "UTC"}) // 9 June at 3:00 pm NZT + var displayTime = formatter.formatRange(new Date(event.scheduled_start_time), new Date(event.scheduled_end_time)) + " (UTC)" } else { var displayTime = discordTime.convertDiscordTime(unixSeconds, "F") } diff --git a/src/d2m/converters/message-to-event.test.js b/src/d2m/converters/message-to-event.test.js index 397be39..a7b1733 100644 --- a/src/d2m/converters/message-to-event.test.js +++ b/src/d2m/converters/message-to-event.test.js @@ -1589,12 +1589,12 @@ test("message2event: irl invite event renders embed", async t => { { $type: "m.room.message", msgtype: "m.notice", - body: `| Scheduled Event - 8 June at 10:00 pm NZT – 9 June at 12:00 am NZT` + body: `| Scheduled Event - Sunday, 8 June, 10:00 am – 12:00 pm (UTC)` + `\n| ## forest exploration` + `\n| ` + `\n| 📍 the dark forest`, format: "org.matrix.custom.html", - formatted_body: `

Scheduled Event - 8 June at 10:00 pm NZT – 9 June at 12:00 am NZT

` + formatted_body: `

Scheduled Event - Sunday, 8 June, 10:00 am – 12:00 pm (UTC)

` + `forest exploration` + `

📍 the dark forest

`, "m.mentions": {} @@ -1622,13 +1622,13 @@ test("message2event: vc invite event renders embed", async t => { { $type: "m.room.message", msgtype: "m.notice", - body: `| Scheduled Event - 9 June at 3:00 pm NZT` + body: `| Scheduled Event - Monday, 9 June 2025 at 3:00 am (UTC)` + `\n| ## Cooking (Netrunners)` + `\n| Short circuited brain interfaces actually just means your brain is medium rare, yum.` + `\n| ` + `\n| 🔊 Cooking`, format: "org.matrix.custom.html", - formatted_body: `

Scheduled Event - 9 June at 3:00 pm NZT

` + formatted_body: `

Scheduled Event - Monday, 9 June 2025 at 3:00 am (UTC)

` + `Cooking (Netrunners)
Short circuited brain interfaces actually just means your brain is medium rare, yum.` + `

🔊 Cooking

`, "m.mentions": {} @@ -1664,13 +1664,13 @@ test("message2event: vc invite event renders embed with room link", async t => { { $type: "m.room.message", msgtype: "m.notice", - body: `| Scheduled Event - 9 June at 3:00 pm NZT` + body: `| Scheduled Event - Monday, 9 June 2025 at 3:00 am (UTC)` + `\n| ## Cooking (Netrunners)` + `\n| Short circuited brain interfaces actually just means your brain is medium rare, yum.` + `\n| ` + `\n| 🔊 Hey. - https://matrix.to/#/!FuDZhlOAtqswlyxzeR:cadence.moe?via=cadence.moe`, format: "org.matrix.custom.html", - formatted_body: `

Scheduled Event - 9 June at 3:00 pm NZT

` + formatted_body: `

Scheduled Event - Monday, 9 June 2025 at 3:00 am (UTC)

` + `Cooking (Netrunners)
Short circuited brain interfaces actually just means your brain is medium rare, yum.` + `

🔊 Hey. - Hey.

`, "m.mentions": {}