MCPcopy Create free account
hub / github.com/dailydotdev/apps / formatDateRange

Function formatDateRange

packages/shared/src/lib/dateFormat.ts:388–403  ·  view source on GitHub ↗
(
  startDate: Date | number | string | null | undefined,
  endDate?: Date | number | string | null | undefined,
)

Source from the content-addressed store, hash-verified

386 });
387
388export const formatDateRange = (
389 startDate: Date | number | string | null | undefined,
390 endDate?: Date | number | string | null | undefined,
391): string => {
392 const parts: string[] = [];
393
394 if (startDate) {
395 parts.push(format(new Date(startDate), 'MMM yyyy'));
396 }
397
398 if (endDate) {
399 parts.push(format(new Date(endDate), 'MMM yyyy'));
400 }
401
402 return parts.join(' - ');
403};

Callers 1

UserExperienceItemFunction · 0.90

Calls 2

formatFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected