ENGLISH·COURSE API
    Preparing search index...
    • Split a duration in seconds into hours and minutes for display.

      Parameters

      • seconds: number

        A duration in seconds. Negative input is treated as zero.

      Returns DurationParts

      The duration as whole hours and the remaining whole minutes.

      Returns parts rather than a formatted string on purpose: pluralisation and word order differ across en, es and pt, so the joining belongs in the ICU messages, not here. Callers pick a message key from whether hours is zero and interpolate both numbers.

      The whole course is the reason this exists. Module durations run from 28 to 635 minutes, and rendering the longest as "635 min" is accurate but unreadable.

      Rounding happens once, on the total, before the split. Rounding hours and minutes independently would let 59m30s surface as "60 min" instead of rolling over into "1 h". Anything above zero reports at least one minute, so a short lesson never reads as free.

      formatDuration(1680);  // { hours: 0, minutes: 28 }
      formatDuration(38100); // { hours: 10, minutes: 35 }