MCPcopy
hub / github.com/callumalpass/tasknotes / formatTime

Function formatTime

src/utils/helpers.ts:197–208  ·  view source on GitHub ↗
(minutes: number)

Source from the content-addressed store, hash-verified

195 * Format time in minutes to a readable string (e.g., "1h 30m", "45m")
196 */
197export function formatTime(minutes: number): string {
198 if (!minutes || minutes === 0 || isNaN(minutes)) {
199 return "0m";
200 }
201
202 const hours = Math.floor(minutes / 60);
203 const mins = minutes % 60;
204
205 if (hours === 0) return `${mins}m`;
206 if (mins === 0) return `${hours}h`;
207 return `${hours}h ${mins}m`;
208}
209
210/**
211 * Parses a time string in the format HH:MM and returns hours and minutes

Callers 8

formatTimeMethod · 0.90
createMetadataSectionMethod · 0.90
helpers.test.tsFile · 0.90
renderOverviewStatsMethod · 0.50
renderTimeRangeStatsMethod · 0.50
renderProjectStatsMethod · 0.50
renderOverviewStatsMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected