1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix: update lodash calls (#6996)

This commit is contained in:
Ben McCann 2024-02-09 08:03:17 -08:00 committed by GitHub
parent b67fddf4b8
commit 9d072b5f55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
import type { AssetResponseDto } from '@api'; import type { AssetResponseDto } from '@api';
import { chain } from 'lodash-es'; import { groupBy, sortBy } from 'lodash-es';
import { DateTime, Interval } from 'luxon'; import { DateTime, Interval } from 'luxon';
export const fromLocalDateTime = (localDateTime: string) => DateTime.fromISO(localDateTime, { zone: 'UTC' }); export const fromLocalDateTime = (localDateTime: string) => DateTime.fromISO(localDateTime, { zone: 'UTC' });
@ -45,8 +45,8 @@ export function splitBucketIntoDateGroups(
assets: AssetResponseDto[], assets: AssetResponseDto[],
locale: string | undefined, locale: string | undefined,
): AssetResponseDto[][] { ): AssetResponseDto[][] {
return chain(assets) const grouped = groupBy(assets, (asset) =>
.groupBy((asset) => fromLocalDateTime(asset.localDateTime).toLocaleString(groupDateFormat, { locale })) fromLocalDateTime(asset.localDateTime).toLocaleString(groupDateFormat, { locale }),
.sortBy((group) => assets.indexOf(group[0])) );
.value(); return sortBy(grouped, (group) => assets.indexOf(group[0]));
} }