···99} from 'preact/hooks';
1010import QuickPinchZoom, { make3dTransformValue } from 'react-quick-pinch-zoom';
11111212+import formatDuration from '../utils/format-duration';
1213import mem from '../utils/mem';
1314import states from '../utils/states';
14151516import Icon from './icon';
1617import Link from './link';
1717-import { formatDuration } from './status';
18181919const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755
2020
-15
src/components/status.jsx
···28722872 );
28732873}
2874287428752875-export function formatDuration(time) {
28762876- if (!time) return;
28772877- let hours = Math.floor(time / 3600);
28782878- let minutes = Math.floor((time % 3600) / 60);
28792879- let seconds = Math.round(time % 60);
28802880-28812881- if (hours === 0) {
28822882- return `${minutes}:${seconds.toString().padStart(2, '0')}`;
28832883- } else {
28842884- return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds
28852885- .toString()
28862886- .padStart(2, '0')}`;
28872887- }
28882888-}
28892889-28902875function nicePostURL(url) {
28912876 if (!url) return;
28922877 const urlObj = new URL(url);
+14
src/utils/format-duration.jsx
···11+export default function formatDuration(time) {
22+ if (!time) return;
33+ let hours = Math.floor(time / 3600);
44+ let minutes = Math.floor((time % 3600) / 60);
55+ let seconds = Math.round(time % 60);
66+77+ if (hours === 0) {
88+ return `${minutes}:${seconds.toString().padStart(2, '0')}`;
99+ } else {
1010+ return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds
1111+ .toString()
1212+ .padStart(2, '0')}`;
1313+ }
1414+}