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

Function daysLeftOf

packages/shared/src/features/boost/BoostManager.tsx:275–290  ·  view source on GitHub ↗
({ endedAt }: Campaign)

Source from the content-addressed store, hash-verified

273 });
274
275const daysLeftOf = ({ endedAt }: Campaign): string => {
276 const end = new Date(endedAt);
277
278 // A boost keeps going past its end date until its budget is spent
279 if (end.getTime() <= Date.now()) {
280 return 'Finishing its budget';
281 }
282
283 const days = getAbsoluteDifferenceInDays(end, new Date());
284
285 if (days === 0) {
286 return 'Ends today';
287 }
288
289 return days === 1 ? '1 day left' : `${days} days left`;
290};
291
292/** Full at the start, emptying as the days run out. Capped under 100, where
293 * ProgressCircle swaps the ring for a check mark */

Callers 1

TimeLeftFunction · 0.85

Calls 1

Tested by

no test coverage detected