Emacs Chats again, which means scheduling, which means timezones. Let's see first if anyone happens to match up with the Thursday timeslots (10:30 or 12:45) that I'd like to use for Emacs-y video things, but I might be able to shuffle things around if needed.
I want something that can translate times into people's local timezones.
I use Org Mode timestamps a lot because they're so easy to insert with C-u C-c ! (org-timestamp-inactive), which inserts a timestamp like this:
[2026-04-16 Thu 10:30]
By default, the Org HTML export for it does not include the timezone offset. That's easily fixed by adding %z to the time specifier, like this:
(setq org-html-datetime-formats '("%F" . "%FT%T%z"))
function translateTime(event) {
if (event.target.getAttribute('datetime')?.match(/[0-9][0-9][0-9][0-9]$/)) {
if (event.target.querySelector('.translated')) {
event.target.querySelectorAll('.translated').forEach((o) => o.remove());
} else {
const span = document.createElement('span');
span.classList.add('translated');
span.textContent = ' → ' + (new Date(event.target.getAttribute('datetime'))).toLocaleString(undefined, {
month: 'short',
day: 'numeric',
hour: 'numeric',
minute: '2-digit',
timeZoneName: 'short'
});
event.target.appendChild(span);
}
}
}
function clickForLocalTime() {
document.querySelectorAll('time').forEach((o) => {
if (o.getAttribute('datetime')?.match(/[0-9][0-9][0-9][0-9]$/)) {
o.addEventListener('click', translateTime);
o.classList.add('clickable');
}
});
}
.clickable {
cursor: pointer;
text-decoration: underline dotted;
}
View Org source for this post
You can e-mail me at sacha@sachachua.com.
( 1
min )