MCPcopy Create free account
hub / github.com/UI5/webcomponents / getDateInstance

Method getDateInstance

packages/localization/src/DateFormat.ts:35–49  ·  view source on GitHub ↗
(oFormatOptionsOrLocale?: DateFormatOptions | LocaleWrapped, oLocale?: LocaleWrapped)

Source from the content-addressed store, hash-verified

33 static getDateInstance(oFormatOptions?: DateFormatOptions, oLocale?: LocaleWrapped): DateFormat;
34 static getDateInstance(oLocale?: LocaleWrapped): DateFormat;
35 static getDateInstance(oFormatOptionsOrLocale?: DateFormatOptions | LocaleWrapped, oLocale?: LocaleWrapped): DateFormat {
36 const locale = oLocale ?? new LocaleWrapped(getLocale().toString());
37
38 if (oFormatOptionsOrLocale instanceof LocaleWrapped) {
39 return DateFormatWrapped.getDateInstance(undefined, oFormatOptionsOrLocale);
40 }
41
42 const cacheKey = `${JSON.stringify(oFormatOptionsOrLocale ?? {})}__${String(locale)}`;
43 let instance = _dateFormatCache.get(cacheKey);
44 if (!instance) {
45 instance = DateFormatWrapped.getDateInstance(oFormatOptionsOrLocale, locale);
46 _dateFormatCache.set(cacheKey, instance);
47 }
48 return instance;
49 }
50}
51
52export default DateFormat;

Callers 15

getFormatMethod · 0.80
getDisplayFormatMethod · 0.80
getFormatMethod · 0.80
getDisplayFormatMethod · 0.80
getValueFormatMethod · 0.80
getISOFormatMethod · 0.80
onAfterRenderingMethod · 0.80
_formatYearRangeTextMethod · 0.80
_calculateWeekNumberMethod · 0.80

Calls 3

getLocaleFunction · 0.85
getMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected