Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Using Durations

For-web uses Intl for duration presentation. To display durations to the user, use the useDurationFormat hook:

import { useDurationFormat } from "@revolt/i18n/durations";

function Component() {
  const duration = useDurationFormat();

  // Will display "67 seconds" in the users locale.
  return <span>A funny amount of seconds is: {duration({seconds: 67})}</span>
}

The hook defaults to long formatting. You can pass all standard Intl.DurationFormatOptions options to the duration function.