MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / formatDate

Function formatDate

console/src/utils/dateFormat.ts:41–59  ·  view source on GitHub ↗
(
  date: FormatParameters[0],
  formatString: FormatInTimezoneParameters[1],
  timezone: FormatInTimezoneParameters[2] = Intl.DateTimeFormat().resolvedOptions()
    .timeZone,
  options?: FormatInTimezoneParameters[3],
)

Source from the content-addressed store, hash-verified

39 * This function should be used instead of date-fns' `format`.
40 */
41export function formatDate(
42 date: FormatParameters[0],
43 formatString: FormatInTimezoneParameters[1],
44 timezone: FormatInTimezoneParameters[2] = Intl.DateTimeFormat().resolvedOptions()
45 .timeZone,
46 options?: FormatInTimezoneParameters[3],
47) {
48 try {
49 const formattedString = formatInTimeZone(
50 date,
51 timezone,
52 formatString,
53 options,
54 );
55 return formattedString;
56 } catch {
57 return format(date, formatString, options);
58 }
59}
60
61export function formatDateInUtc(
62 timestampOrDate: number | Date,

Callers 15

GraphTooltipBucketRangeFunction · 0.90
formatExpirationDateFunction · 0.90
ConnectorErrorsTableFunction · 0.90
StatusEventToastFunction · 0.90
WorkflowGraphSidebarFunction · 0.90
dateFormat.test.tsFile · 0.90
ApiTokensTablePropsFunction · 0.90
ObjectIndexesContentFunction · 0.90
ObjectCreatedAtFunction · 0.90
SourceOverviewFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected