diff --git a/web/src/lib/utils/timeline-util.ts b/web/src/lib/utils/timeline-util.ts index 10422e59e2..e6e33d0b2f 100644 --- a/web/src/lib/utils/timeline-util.ts +++ b/web/src/lib/utils/timeline-util.ts @@ -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])); }