mirror of
https://github.com/immich-app/immich.git
synced 2025-01-10 13:56:47 +01:00
4e526dfaae
* feat(web): improve and refactor thumbnails * only play live photos on icon hover
13 lines
354 B
TypeScript
13 lines
354 B
TypeScript
import { Duration } from 'luxon';
|
|
|
|
/**
|
|
* Convert time like `01:02:03.456` to seconds.
|
|
*/
|
|
export function timeToSeconds(time: string) {
|
|
const parts = time.split(':');
|
|
parts[2] = parts[2].split('.').slice(0, 2).join('.');
|
|
|
|
const [hours, minutes, seconds] = parts.map(Number);
|
|
|
|
return Duration.fromObject({ hours, minutes, seconds }).as('seconds');
|
|
}
|