MCPcopy Index your code
hub / github.com/plotly/dash / formatYear

Function formatYear

components/dash-core-components/src/utils/calendar/helpers.ts:251–257  ·  view source on GitHub ↗
(year: number, formatStr?: string)

Source from the content-addressed store, hash-verified

249 * Formats a year according to the year format extracted from month_format.
250 */
251export function formatYear(year: number, formatStr?: string): string {
252 const {yearFormat} = extractFormats(formatStr);
253 const convertedFormat = convertFormatTokens(yearFormat);
254 return format(new Date(year, 0, 1), convertedFormat, {
255 locale: getUserLocale(),
256 });
257}
258
259/**
260 * Parses a year string and converts it to a full 4-digit year.

Callers 2

CalendarComponentFunction · 0.90
helpers.test.tsFile · 0.90

Calls 3

extractFormatsFunction · 0.85
convertFormatTokensFunction · 0.85
getUserLocaleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…