瀏覽代碼

update payment deadline display format in apply application

CR013B2
Jason Chuang 1 周之前
父節點
當前提交
e18fe48bf7
共有 1 個文件被更改,包括 5 次插入6 次删除
  1. +5
    -6
      src/utils/DateUtils.js

+ 5
- 6
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}分`;
};




Loading…
取消
儲存