Skip to main content
/
/
/
FormatDuration

FormatDuration

Human-readable duration between two dates

React
import FormatDuration from "@intility/bifrost-react/FormatDuration";
FormatDuration
Go to top
Props
New in 6.10

Display human-readable duration between a start and end Date object, with a tooltip displaying full datetime including time zone.

  • Displays days if over 2: "7 days"
  • Displays hours if over 2: "24 hours"
  • Otherwise minutes: "30 minutes"
TSX
<FormatDuration start={startDate} end={endDate} />
4 hours
Datepicker range demo with presets
Compatibility

Sandbox

7 days4 hours30 minutes