Skip to content
Permalink
Browse files
fix(b-calendar): use Intl.NumberFormat for formatting the number in…
… 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 cbf2cd007cce81a5f664fa649b08af6735fe16e4
Showing 1 changed file with 11 additions and 3 deletions.
@@ -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() {

0 comments on commit cbf2cd0

Please sign in to comment.