1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02: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 { chain } from 'lodash-es';
import { groupBy, sortBy } from 'lodash-es';
import { DateTime, Interval } from 'luxon';
export const fromLocalDateTime = (localDateTime: string) => DateTime.fromISO(localDateTime, { zone: 'UTC' });
@ -45,8 +45,8 @@ export function splitBucketIntoDateGroups(
assets: AssetResponseDto[],
locale: string | undefined,
): AssetResponseDto[][] {
return chain(assets)
.groupBy((asset) => fromLocalDateTime(asset.localDateTime).toLocaleString(groupDateFormat, { locale }))
.sortBy((group) => assets.indexOf(group[0]))
.value();
const grouped = groupBy(assets, (asset) =>
fromLocalDateTime(asset.localDateTime).toLocaleString(groupDateFormat, { locale }),
);
return sortBy(grouped, (group) => assets.indexOf(group[0]));
}