Skip to content

Commit

Permalink
fix(b-calendar): use Intl.NumberFormat for formatting the number in…
Browse files Browse the repository at this point in the history
… the date buttons (closes #5171) (#5179)

* fix(b-calendar): use Intl.NumberFormat for formatting the date buttons (closes #5171)

* Update calendar.js

Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
  • Loading branch information
tmorehouse and jacobmllr95 committed Apr 18, 2020
1 parent 5160aef commit cbf2cd0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/calendar/calendar.js
Expand Up @@ -442,10 +442,18 @@ export const BCalendar = Vue.extend({
})
},
formatDay() {
return createDateFormatter(this.calendarLocale, {
day: STR_NUMERIC,
calendar: STR_GREGORY
// Calendar grid day number formatter
// We don't use DateTimeFormatter here as it can place extra
// character(s) after the number (i.e the `zh` locale)
const nf = new Intl.NumberFormat([this.computedLocale], {
style: 'decimal',
minimumIntegerDigits: 1,
minimumFractionDigits: 0,
maximumFractionDigits: 0,
notation: 'standard'
})
// Return a formatter function instance
return date => nf.format(date.getDate())
},
// Disabled states for the nav buttons
prevDecadeDisabled() {
Expand Down

0 comments on commit cbf2cd0

Please sign in to comment.