Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

441 B
Raw Blame
/* eslint-disable i18next/no-literal-string -- unit letters stay English in every language */
export const formatDuration = (durationMs: number): string => {
  const hours = Math.floor(durationMs / 3600000);
  const minutes = Math.floor((durationMs % 3600000) / 60000);
  const seconds = Math.floor((durationMs % 60000) / 1000);

  if (hours > 0) {
    return `${hours}h ${minutes}m ${seconds}s`;
  }

  return `${minutes}m ${seconds}s`;
};