Skip to content

Commit

Permalink
This closes #1338, fix apply AM/PM format issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Sep 3, 2022
1 parent 75ce231 commit 00470c1
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 155 deletions.
6 changes: 4 additions & 2 deletions numfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
Expand Down Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 00470c1

Please sign in to comment.