How is "typical time spent per user within X days" calculated?

This article explains how the Analytics page's typical time spent per user within 7 or 30 days is calculated.

Analytics don't show average time spent, but rather typical time ("middle one of all times") since average can skew the results with smaller users as couple of users might spend an hour or two there and 19 other users 1-2 minutes.
So for example if 5 users have visited the workspace:
  • 1 min
  • 2 min
  • 2 min <--- the most typical time
  • 4 min
  • 2 hours (120 minutes)
The typical time in above example is "2 minutes" which is more representative than saying average time is 25 minutes.
Idle time is calculated, so if the workspace is open in a tab, it is still recorded to the typical time spent. This might be also device/browser dependant.