From 00470c17d95cb0f70b57b6fb0092b6f873949cd1 Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 3 Sep 2022 20:16:35 +0800 Subject: This closes #1338, fix apply AM/PM format issue --- numfmt.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'numfmt.go') 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 { -- cgit v1.2.1