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

Function timeLeftOf

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

Source from the content-addressed store, hash-verified

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

Callers 1

TimeLeftFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected