Skip to content

Commit 0725f85

Browse files
committed
feat: fix #63
1 parent 59cdb95 commit 0725f85

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/formatDate.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@
210210
if (nDate.hour > 12) { //See the clock system: https://en.wikipedia.org/wiki/12-hour_clock
211211
nDate.hour %= 12;
212212
}
213+
if (nDate.hour === 0) {
214+
nDate.hour = 12;
215+
}
213216
nDate.meridiem = meridiem;
214217
}
215218

@@ -224,4 +227,3 @@
224227

225228
tui.util.formatDate = formatDate;
226229
})(window.tui);
227-

test/formatDate.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('date format', function() {
5555
expect(formatDate(forms[8], inputs[0])).toEqual('Sep 09 1999 00:02');
5656
});
5757
it('-> MMMM DD YYYY H:m A', function() {
58-
expect(formatDate(forms[9], inputs[0])).toEqual('September 09 1999 0:2 AM');
58+
expect(formatDate(forms[9], inputs[0])).toEqual('September 09 1999 12:2 AM');
5959
});
6060
});
6161

@@ -216,7 +216,7 @@ describe('date format', function() {
216216
nDate = date.date,
217217
dt = new Date(nYear, nMonth, nDate, date.hour, date.minute);
218218

219-
expect(formatDate(forms[9], dt)).toEqual('September 09 1999 0:2 AM');
219+
expect(formatDate(forms[9], dt)).toEqual('September 09 1999 12:2 AM');
220220
});
221221
});
222222

0 commit comments

Comments
 (0)