Skip to content

Commit

Permalink
fix datetime format cache (#859)
Browse files Browse the repository at this point in the history
closes #855
  • Loading branch information
kazupon committed Apr 25, 2020
1 parent 4ef365e commit d863d1d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,24 @@ export default class VueI18n {
setDateTimeFormat (locale: Locale, format: DateTimeFormat): void {
this._vm.$set(this._vm.dateTimeFormats, locale, format)
this._clearDateTimeFormat(locale, format)
}
mergeDateTimeFormat (locale: Locale, format: DateTimeFormat): void {
this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format))
this._clearDateTimeFormat(locale, format)
}
_clearDateTimeFormat (locale: Locale, format: DateTimeFormat): void {
for (let key in format) {
const id = `${locale}__${key}`
if (!this._dateTimeFormatters.hasOwnProperty(id)) {
continue
}
delete this._dateTimeFormatters[id]
}
}
_localizeDateTime (
Expand Down

0 comments on commit d863d1d

Please sign in to comment.