mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
feat(web): improve and refactor thumbnails (#2087)
* feat(web): improve and refactor thumbnails * only play live photos on icon hover
This commit is contained in:
13
web/src/lib/utils/time-to-seconds.ts
Normal file
13
web/src/lib/utils/time-to-seconds.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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');
|
||||
}
|
||||
Reference in New Issue
Block a user