Thanks for your consideration of this and suggestions, Todd!
Not quite - this isn’t the problem. It doesn’t actually really matter if it is local or user (will be the same in most cases).
The issue is that our particular timezone is misleading due to the text it contains (it is the only New Zealand timezone). This also applies to you: in your example above, it implies the event will be held in Little Creek, Chicago.
This is what I’m going for instead:
Well, after hitting my head against the vibe coding wall for a bit, I’ve got this bit of javascript (put in the JS tab of a local Theme Component) which is doing the trick for me:
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer("swap-auckland-for-nz", (api) => {
function swapTimezones(root = document) {
root.querySelectorAll('.relative-time').forEach(elem => {
if (elem.textContent && elem.textContent.includes('(Auckland)')) {
elem.textContent = elem.textContent.replace('(Auckland)', '(NZ)');
}
});
}
api.onPageChange(() => {
swapTimezones(document);
// Set up persistent mutation observer for dynamic events/calendar output
const observer = new MutationObserver(() => {
swapTimezones(document);
});
observer.observe(document.body, { childList: true, subtree: true });
// Optionally, also run again after other navigation events
window.addEventListener("hashchange", () => swapTimezones(document));
window.addEventListener("popstate", () => swapTimezones(document));
});
});
If I find the time, I’ll wrap this up as an installable Theme Component so others can use it if desired.
