MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getTimeRemaining

Function getTimeRemaining

apps/cli/src/commands/auth/status.ts:83–99  ·  view source on GitHub ↗
(date: Date)

Source from the content-addressed store, hash-verified

81}
82
83function getTimeRemaining(date: Date): string {
84 const now = new Date()
85 const diff = date.getTime() - now.getTime()
86
87 if (diff <= 0) {
88 return "expired"
89 }
90
91 const days = Math.floor(diff / (1000 * 60 * 60 * 24))
92 const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
93
94 if (days > 0) {
95 return `${days} day${days === 1 ? "" : "s"}`
96 }
97
98 return `${hours} hour${hours === 1 ? "" : "s"}`
99}

Callers 1

statusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected