summaryrefslogtreecommitdiff
path: root/numfmt.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-09-03 20:16:35 +0800
committerxuri <xuri.me@gmail.com>2022-09-03 20:16:35 +0800
commit00470c17d95cb0f70b57b6fb0092b6f873949cd1 (patch)
tree5fb6fe259f604800456e97b8c279d8223fdcb1a7 /numfmt.go
parent75ce2317286181e2c250c10206df892278d5b981 (diff)
This closes #1338, fix apply AM/PM format issue
Diffstat (limited to 'numfmt.go')
-rw-r--r--numfmt.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/numfmt.go b/numfmt.go
index 56f354f..fd99240 100644
--- a/numfmt.go
+++ b/numfmt.go
@@ -696,7 +696,7 @@ func (nf *numberFormat) dateTimesHandler(i int, token nfp.Token) {
nextHours := nf.hoursNext(i)
aps := strings.Split(nf.localAmPm(token.TValue), "/")
nf.ap = aps[0]
- if nextHours > 12 {
+ if nextHours >= 12 {
nf.ap = aps[1]
}
}
@@ -777,9 +777,11 @@ func (nf *numberFormat) hoursHandler(i int, token nfp.Token) {
ap, ok := nf.apNext(i)
if ok {
nf.ap = ap[0]
+ if h >= 12 {
+ nf.ap = ap[1]
+ }
if h > 12 {
h -= 12
- nf.ap = ap[1]
}
}
if nf.ap != "" && nf.hoursNext(i) == -1 && h > 12 {