fix(working hours): invalid timestamps with timezones (closes #417)

This commit is contained in:
Isaac 2023-05-26 16:11:31 +01:00
parent f07e157642
commit 921bdfa447
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -713,7 +713,7 @@ module.exports = class TicketManager {
const next = workingHours[nextIndex]; const next = workingHours[nextIndex];
let then = now.add(nextIndex - now.day(), 'day'); let then = now.add(nextIndex - now.day(), 'day');
if (nextIndex <= now.day()) then = then.add(1, 'week'); if (nextIndex <= now.day()) then = then.add(1, 'week');
const timestamp = Math.ceil(then.time(next[0]).d.getTime() / 1000); // in seconds const timestamp = Math.ceil(then.time(next[0]).goto('utc').d.getTime() / 1000); // in seconds
await channel.send({ await channel.send({
embeds: [ embeds: [
new ExtendedEmbedBuilder() new ExtendedEmbedBuilder()
@ -725,7 +725,7 @@ module.exports = class TicketManager {
} }
} else if (now.isBefore(start)) { // staff haven't started working yet } else if (now.isBefore(start)) { // staff haven't started working yet
working = false; working = false;
const timestamp = Math.ceil(start.d.getTime() / 1000); // in seconds const timestamp = Math.ceil(start.goto('utc').d.getTime() / 1000); // in seconds
await channel.send({ await channel.send({
embeds: [ embeds: [
new ExtendedEmbedBuilder() new ExtendedEmbedBuilder()