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

Function postUpdatedDateFormat

packages/shared/src/lib/dateFormat.ts:124–136  ·  view source on GitHub ↗
(
  value: Date | number | string,
  now = new Date(),
)

Source from the content-addressed store, hash-verified

122}
123
124export function postUpdatedDateFormat(
125 value: Date | number | string,
126 now = new Date(),
127): string {
128 const date = new Date(value);
129
130 if (isSameDay(date, now) || isSameDay(date, subDays(now, 1))) {
131 const relative = publishTimeRelativeShort(value, now);
132 return relative === 'now' ? relative : `${relative} ago`;
133 }
134
135 return postDateFormat(value, now);
136}
137
138export function commentDateFormat(
139 value: Date | number | string,

Callers 1

formatDateFunction · 0.85

Calls 2

publishTimeRelativeShortFunction · 0.85
postDateFormatFunction · 0.85

Tested by

no test coverage detected