show board dates in UTC on the website
Board days are UTC epoch days (midnight UTC), but toLocaleDateString formatted them in the viewer's timezone, so anyone west of UTC saw every game dated the day before. Format them in UTC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c6c53ff13
commit
3d78ff7863
2 files changed
+6
No files matched your search
@@ -316,8 +316,11 @@ async function loadBoard() {
|
||||
|
||||
// If we know the exact epoch day and haven't set date text yet, show it
|
||||
if (finalEpoch !== null && !dateEl.textContent) {
|
||||
// Epoch days start at midnight UTC, so format in UTC or viewers
|
||||
// west of UTC see the previous day
|
||||
dateEl.textContent = new Date(finalEpoch * 86400 * 1000)
|
||||
.toLocaleDateString(undefined, {
|
||||
timeZone: "UTC",
|
||||
weekday: "long",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
|
||||
@@ -134,8 +134,11 @@
|
||||
|
||||
<script>
|
||||
function formatDateFromEpochDays(epochDays) {
|
||||
// Epoch days start at midnight UTC, so format in UTC or viewers
|
||||
// west of UTC see the previous day
|
||||
const date = new Date(epochDays * 86400 * 1000);
|
||||
return date.toLocaleDateString(undefined, {
|
||||
timeZone: "UTC",
|
||||
weekday: "short",
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
|
||||
Reference in new issue
Block a user