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

Function timeLeftOf

packages/shared/src/features/boost/BoostManager.tsx:287–292  ·  view source on GitHub ↗
({ createdAt, endedAt }: Campaign)

Source from the content-addressed store, hash-verified

285/** Full at the start, emptying as the days run out. Capped under 100, where
286 * ProgressCircle swaps the ring for a check mark */
287const timeLeftOf = ({ createdAt, endedAt }: Campaign): number => {
288 const start = new Date(createdAt).getTime();
289 const end = new Date(endedAt).getTime();
290
291 return Math.max(0, Math.min(99, ((end - Date.now()) / (end - start)) * 100));
292};
293
294const endedStatus: Partial<Record<CampaignState, string>> = {
295 [CampaignState.Completed]: 'bg-action-share-active text-action-share-default',

Callers 1

TimeLeftFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected