From e18fe48bf769bd701343f54f6267bb8d1ce974aa Mon Sep 17 00:00:00 2001 From: Jason Chuang Date: Wed, 21 Jan 2026 18:29:13 +0800 Subject: [PATCH] update payment deadline display format in apply application --- src/utils/DateUtils.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/DateUtils.js b/src/utils/DateUtils.js index 0405063..c2a4df1 100644 --- a/src/utils/DateUtils.js +++ b/src/utils/DateUtils.js @@ -42,6 +42,7 @@ export const timeFormat = (date, locale) => { let d; + // 支援 LocalDateTime array if (Array.isArray(date)) { const [y, m, d1, h = 0, min = 0, s = 0] = date; d = dayjs(new Date(y, m - 1, d1, h, min, s)); @@ -55,19 +56,17 @@ export const timeFormat = (date, locale) => { const minute = d.minute(); if (locale === "en") { - return minute === 0 - ? d.format("h a") - : d.format("h:mm a"); + return d.format("h:mm a"); // 12:00 pm } - // 中文顯示(香港慣用) const period = hour < 12 ? "上午" : "下午"; + const h12 = hour % 12 === 0 ? 12 : hour % 12; if (minute === 0) { - return `${period}${d.format("h時")}`; + return `${period}${h12}時`; } - return `${period}${d.format("h時mm分")}`; + return `${period}${h12}時${minute}分`; };