Skip to content

Commit

Permalink
fix date suffix also for standard formatting, ref #173
Browse files Browse the repository at this point in the history
  • Loading branch information
mskocik committed May 19, 2024
1 parent 4506cb0 commit caa1279
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/utils/dateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function formatDate(date, format, i18n, type) {
d: dateVal,
D: i18n.daysShort[date.getDay()],
DD: i18n.days[date.getDay()],
S: (dateVal % 10 && dateVal % 10 <= i18n.suffix.length ? i18n.suffix[dateVal % 10 - 1] : i18n.suffix[i18n.suffix.length -1 ]),
S: (dateVal % 10 && dateVal % 10 < 4 && (dateVal < 10 || dateVal > 14) ? i18n.suffix[dateVal % 10 - 1] : i18n.suffix[i18n.suffix.length -1 ]),
p: (i18n.meridiem.length === 2 ? i18n.meridiem[date.getHours() < 12 ? 0 : 1] : ''),
// hour
h: date.getHours(),
Expand Down

0 comments on commit caa1279

Please sign in to comment.