fix(facade): cache original format string (#12764)

This commit is contained in:
André Werlang 2016-12-05 16:26:59 -02:00 committed by Alex Rickabaugh
parent b8c839bd51
commit a1322873c8
1 changed files with 3 additions and 2 deletions

View File

@ -187,7 +187,8 @@ function dateFormatter(format: string, date: Date, locale: string): string {
if (fn) return fn(date, locale);
let parts = DATE_FORMATTER_CACHE.get(format);
const cacheKey = format;
let parts = DATE_FORMATTER_CACHE.get(cacheKey);
if (!parts) {
parts = [];
@ -205,7 +206,7 @@ function dateFormatter(format: string, date: Date, locale: string): string {
}
}
DATE_FORMATTER_CACHE.set(format, parts);
DATE_FORMATTER_CACHE.set(cacheKey, parts);
}
return parts.reduce((text, part) => {