MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getRemainingLabel

Function getRemainingLabel

src/lib/adRewards.js:289–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287 return Math.max(0, state.remainingMs || state.adFreeUntil - Date.now());
288 },
289 getRemainingLabel() {
290 const remainingMs = this.getRemainingMs();
291 if (!remainingMs) return "No active ad-free pass";
292
293 const minutes = Math.ceil(remainingMs / (60 * 1000));
294 if (minutes < 60) {
295 return `${minutes} minute${minutes === 1 ? "" : "s"} remaining`;
296 }
297
298 const hours = Math.floor(minutes / 60);
299 const remMinutes = minutes % 60;
300 if (!remMinutes) {
301 return `${hours} hour${hours === 1 ? "" : "s"} remaining`;
302 }
303
304 return `${hours}h ${remMinutes}m remaining`;
305 },
306 getExpiryLabel() {
307 const expiryDate = getExpiryDate();
308 if (!expiryDate) return "No active pass";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected