fix: local time for users

This commit is contained in:
naskya 2023-03-21 08:24:02 +09:00
parent 74bb79792d
commit 49d3df43d3
No known key found for this signature in database
GPG Key ID: 164DFF24E2D40139

View File

@ -167,8 +167,8 @@ const timeForThem = $computed(() => {
const tzInfo = cityTimezones.lookupViaCity(props.user.location!.replace(/\s.*/,'')); const tzInfo = cityTimezones.lookupViaCity(props.user.location!.replace(/\s.*/,''));
if (tzInfo.length == 0) return ""; if (tzInfo.length == 0) return "";
const tz = tzInfo[0].timezone; const tz = tzInfo[0].timezone;
const theirTime = new Date().toLocaleString("en-US", { timeZone: tz, hour12: true }) const theirTime = new Date().toLocaleString("en-US", { timeZone: tz, hour12: false });
return ` (${theirTime.split(",")[1].trim().split(":")[0]} ${theirTime.split(" ")[1].slice(-2)})` return ` (${theirTime.split(",")[1].trim().split(":")[0]}:${theirTime.split(" ")[1].slice(-5,-3)})`;
}) })
function menu(ev) { function menu(ev) {