Skip to content

Commit

Permalink
feat: Add locale (zh-tw) meridiem and update format
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin82222 committed Dec 2, 2022
1 parent cbe91fd commit 944bade
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/locale/zh-tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const locale = {
LTS: 'HH:mm:ss',
L: 'YYYY/MM/DD',
LL: 'YYYY年M月D日',
LLL: 'YYYY年M月D日 HH:mm',
LLLL: 'YYYY年M月D日dddd HH:mm',
LLL: 'YYYY年M月D日Ah點mm分',
LLLL: 'YYYY年M月D日ddddAh點mm分',
l: 'YYYY/M/D',
ll: 'YYYY年M月D日',
lll: 'YYYY年M月D日 HH:mm',
Expand All @@ -42,10 +42,24 @@ const locale = {
MM: '%d 個月',
y: '1 年',
yy: '%d 年'
},
meridiem: (hour, minute) => {
const hm = (hour * 100) + minute
if (hm < 600) {
return '凌晨'
} else if (hm < 900) {
return '早上'
} else if (hm < 1100) {
return '上午'
} else if (hm < 1300) {
return '中午'
} else if (hm < 1800) {
return '下午'
}
return '晚上'
}
}

dayjs.locale(locale, null, true)

export default locale

0 comments on commit 944bade

Please sign in to comment.