I thought I was being clever with Intl API, but it was a mistake, had to make it dumb and simple instead. Fixes time display with non-US locales.
This commit is contained in:
Mute 2022-10-27 22:50:08 +00:00
parent 5c534b1537
commit 5c1d2f6397
1 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name MBCHC
// @version dev.4
// @version dev.5
// @description Mute's Bondage Club Hacks Collection
// @author codename.mute@proton.me
// @namespace https://code.fleshless.org/mute/
@ -24,7 +24,7 @@
if (!window.AsylumGGTSSAddItems) throw "AsylumGGTSSAddItems() not found, aborting MBCHC loading"
if (window.MBCHC) throw "MBCHC found, aborting loading"
window.MBCHC = {
VERSION: "dev.4",
VERSION: "dev.5",
TARGET_VERSION: "R85",
NEXT_MESSAGE: 1,
LOG_MESSAGES: false,
@ -623,8 +623,8 @@
window.DrawRect(CharX + 175 * Zoom, CharY, 50 * Zoom, 50 * Zoom, colour)
}
if ((window.ChatRoomHideIconState < 1) && C.MBCHC_LOCAL && C.MBCHC_LOCAL.TZ) {
let localtime = new Date(window.CommonTime() + window.MBCHC.UTC_OFFSET + C.MBCHC_LOCAL.TZ * 60 * 60 * 1000)
let text = localtime.toLocaleTimeString([], {hourCycle: "h24", hour: "2-digit"})
let hours = new Date(window.CommonTime() + window.MBCHC.UTC_OFFSET + C.MBCHC_LOCAL.TZ * 60 * 60 * 1000).getHours()
let text = (hours < 10) ? "0" + hours.toString() : hours.toString()
window.DrawTextFit(text, CharX + 200 * Zoom, CharY + 25 * Zoom, 46 * Zoom, "white", "black")
}
return(next(nextargs))