commit a9f5e56dcd3b82fbebb63c37fa0fdc82ade71d76
parent 2dd1e8c34161d5d040a7b6ebf4b69892445d7026
Author: brookjeynes <me@brookjeynes.dev>
Date: Mon, 1 Jun 2026 21:09:45 +1000
fix: incorrect irregulars in hour time
Signed-off-by: brookjeynes <me@brookjeynes.dev>
Diffstat:
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/store.js b/src/store.js
@@ -1,5 +1,6 @@
import { nativeStringFromNumber } from "./native.js";
import { sinoStringFromNumber } from "./sino.js";
+import { hourStringFromNumber } from "./time.js";
/**
* @typedef {
@@ -131,7 +132,7 @@ window.Alpine.store("app", {
case "native":
return nativeStringFromNumber(this.num);
case "time":
- return `${nativeStringFromNumber(this.time.hour)}시간 ${sinoStringFromNumber(this.time.minute)}분`;
+ return `${hourStringFromNumber(this.time.hour)}시 ${sinoStringFromNumber(this.time.minute)}분`;
default:
throw new Error("unknown tab selected");
}
diff --git a/src/time.js b/src/time.js
@@ -0,0 +1,15 @@
+import { nativeStringFromNumber } from "./native.js";
+
+export function hourStringFromNumber(num) {
+ const str = nativeStringFromNumber(num);
+
+ // Irregulars
+ if (str.startsWith("하나")) return "한" + str.slice(2);
+ if (str.startsWith("둘")) return "두" + str.slice(1);
+ if (str.startsWith("셋")) return "세" + str.slice(1);
+ if (str.startsWith("넷")) return "네" + str.slice(1);
+ if (str.startsWith("열하나")) return "열한" + str.slice(3);
+ if (str.startsWith("열둘")) return "열두" + str.slice(2);
+
+ return str;
+}