fix(facade): cache original format string (#12764)
This commit is contained in:
parent
b8c839bd51
commit
a1322873c8
|
@ -187,7 +187,8 @@ function dateFormatter(format: string, date: Date, locale: string): string {
|
||||||
|
|
||||||
if (fn) return fn(date, locale);
|
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) {
|
if (!parts) {
|
||||||
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) => {
|
return parts.reduce((text, part) => {
|
||||||
|
|
Loading…
Reference in New Issue