From 634820dbaae58f725cb8b54a75921592706ba126 Mon Sep 17 00:00:00 2001
From: Luca <45944543+AfoxDesignz@users.noreply.github.com>
Date: Sat, 11 Jul 2026 02:24:35 +0200
Subject: [PATCH] feat(timezones): show recipient timezone in dms + fix
showLocalTimezone (#1244)
* feat(timezones): show recipient timezone in dms
* fix(timezones): make sure showOwnTimezone is not bypassed
* fix(timezones): prevent showLocalTimezone from minifying every timezone instead of just local
---
src/equicordplugins/timezones/index.tsx | 31 +++++++++++++++++++------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/equicordplugins/timezones/index.tsx b/src/equicordplugins/timezones/index.tsx
index 6e9ceb7e2..f0ced70a6 100644
--- a/src/equicordplugins/timezones/index.tsx
+++ b/src/equicordplugins/timezones/index.tsx
@@ -14,7 +14,7 @@ import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Message, User } from "@vencord/discord-types";
import { findByPropsLazy, findCssClassesLazy } from "@webpack";
-import { Button, Menu, openModal, showToast, Toasts, Tooltip, useEffect, UserStore, useState } from "@webpack/common";
+import { Button, ChannelStore, Menu, openModal, showToast, Toasts, Tooltip, useEffect, UserStore, useState } from "@webpack/common";
import { deleteTimezone, getTimezone, loadDatabaseTimezones, setUserDatabaseTimezone } from "./database";
import { SetTimezoneModal } from "./TimezoneModal";
@@ -66,6 +66,12 @@ export const settings = definePluginSettings({
default: true
},
+ recipientTimezoneInDms: {
+ type: OptionType.BOOLEAN,
+ description: "In DMs, show the recipient's timezone on your messages",
+ default: false
+ },
+
showProfileTime: {
type: OptionType.BOOLEAN,
description: "Show time in profiles",
@@ -201,13 +207,13 @@ const TimestampComponent = ErrorBoundary.wrap(({ userId, timestamp, type }: Prop
if (settings.store.showTimezoneInfo) {
const userTimezone = getSystemTimezone();
- if (timezone === userTimezone && !settings.store.showLocalTimezone) {
+ isLocal = timezone === userTimezone;
+ if (isLocal && !settings.store.showLocalTimezone) {
displayTime = "local";
- isLocal = true;
} else {
const timezoneInfo = getTimezoneAbbreviation(timezone, currentTime);
const tz = timezoneInfo || timezone;
- const hideLocalTime = settings.store.showLocalTimezone && type === "message";
+ const hideLocalTime = isLocal && type === "message";
displayTime = hideLocalTime ? tz : `${shortTime} ${tz}`;
}
}
@@ -349,9 +355,20 @@ export default definePlugin({
},
renderMessageTimezone: (props?: { message?: Message; }) => {
- if (!settings.store.showMessageHeaderTime || !props?.message) return null;
- if (props.message.author.id === UserStore.getCurrentUser().id && !settings.store["Show Own Timezone"]) return null;
+ const { showMessageHeaderTime, recipientTimezoneInDms, "Show Own Timezone": showOwnTimezone } = settings.store;
- return ;
+ if (!showMessageHeaderTime || !props?.message) return null;
+
+ let userId = props.message.author.id;
+
+ if (userId === UserStore.getCurrentUser().id) {
+ const channel = recipientTimezoneInDms ? ChannelStore.getChannel(props.message.channel_id) : undefined;
+ const recipientId = channel?.type === 1 ? channel.recipients[0] : undefined;
+
+ if (recipientId && resolveUserTimezone(recipientId)) userId = recipientId;
+ else if (!showOwnTimezone) return null;
+ }
+
+ return ;
}
});