organisation level time tracking data, export as JSON or CSV

This commit is contained in:
2026-01-28 17:31:01 +00:00
parent 56dcf1c24c
commit 0fffbfeb1f
2 changed files with 198 additions and 5 deletions

View File

@@ -69,3 +69,19 @@ export const isLight = (hex: string): boolean => {
export const unCamelCase = (str: string): string => {
return str.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/^./, (char) => char.toUpperCase());
};
export const formatDuration = (ms: number): string => {
if (ms === 0) return "0s";
const totalSeconds = Math.floor(ms / 1000);
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
const parts: string[] = [];
if (hours > 0) parts.push(`${hours}h`);
if (minutes > 0) parts.push(`${minutes}m`);
if (seconds > 0 || (hours === 0 && minutes === 0)) parts.push(`${seconds}s`);
return parts.join(" ") || "0s";
};