mirror of
https://github.com/immich-app/immich.git
synced 2025-01-12 15:32:36 +02:00
fix(web) fix test (#1059)
This commit is contained in:
parent
5d140145c1
commit
966d99217a
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
$: [spaceUsage, spaceUnit] = getBytesWithUnit(stats.usageRaw);
|
$: [spaceUsage, spaceUnit] = getBytesWithUnit(stats.usageRaw);
|
||||||
|
|
||||||
const locale = navigator.languages;
|
const locale = navigator.language;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col gap-5">
|
<div class="flex flex-col gap-5">
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<div class="flex mt-5 justify-between">
|
<div class="flex mt-5 justify-between">
|
||||||
<StatsCard logo={CameraIris} title={'PHOTOS'} value={stats.photos.toString()} />
|
<StatsCard logo={CameraIris} title={'PHOTOS'} value={stats.photos.toString()} />
|
||||||
<StatsCard logo={PlayCircle} title={'VIDEOS'} value={stats.videos.toString()} />
|
<StatsCard logo={PlayCircle} title={'VIDEOS'} value={stats.videos.toString()} />
|
||||||
<StatsCard logo={Memory} title={'STORAGE'} value={spaceUsage} unit={spaceUnit} />
|
<StatsCard logo={Memory} title={'STORAGE'} value={spaceUsage.toString()} unit={spaceUnit} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
return user.deletedAt != null;
|
return user.deletedAt != null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const locale = navigator.languages;
|
const locale = navigator.language;
|
||||||
const deleteDateFormat: Intl.DateTimeFormatOptions = {
|
const deleteDateFormat: Intl.DateTimeFormatOptions = {
|
||||||
month: 'long', day: 'numeric', year: 'numeric'
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric'
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDeleteDate = (user: UserResponseDto): string => {
|
const getDeleteDate = (user: UserResponseDto): string => {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
imageData = (await loadHighQualityThumbnail(album.albumThumbnailAssetId)) || NO_THUMBNAIL;
|
imageData = (await loadHighQualityThumbnail(album.albumThumbnailAssetId)) || NO_THUMBNAIL;
|
||||||
});
|
});
|
||||||
|
|
||||||
const locale = navigator.languages;
|
const locale = navigator.language;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -86,12 +86,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const locale = navigator.languages;
|
const locale = navigator.language;
|
||||||
const albumDateFormat: Intl.DateTimeFormatOptions = {
|
const albumDateFormat: Intl.DateTimeFormatOptions = {
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric'
|
year: 'numeric'
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDateRange = () => {
|
const getDateRange = () => {
|
||||||
const startDate = new Date(album.assets[0].createdAt);
|
const startDate = new Date(album.assets[0].createdAt);
|
||||||
@ -101,7 +101,9 @@
|
|||||||
const endDateString = endDate.toLocaleDateString(locale, albumDateFormat);
|
const endDateString = endDate.toLocaleDateString(locale, albumDateFormat);
|
||||||
|
|
||||||
// If the start and end date are the same, only show one date
|
// If the start and end date are the same, only show one date
|
||||||
return startDateString === endDateString ? startDateString : `${startDateString} - ${endDateString}`;
|
return startDateString === endDateString
|
||||||
|
? startDateString
|
||||||
|
: `${startDateString} - ${endDateString}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
const locale = navigator.languages;
|
const locale = navigator.language;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="p-2 dark:bg-immich-dark-bg dark:text-immich-dark-fg">
|
<section class="p-2 dark:bg-immich-dark-bg dark:text-immich-dark-fg">
|
||||||
@ -100,10 +100,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p>{assetDateTimeOriginal.toLocaleDateString(locale, {month:'short', day:'numeric', year: 'numeric'})}</p>
|
<p>
|
||||||
|
{assetDateTimeOriginal.toLocaleDateString(locale, {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric'
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
<div class="flex gap-2 text-sm">
|
<div class="flex gap-2 text-sm">
|
||||||
<p>
|
<p>
|
||||||
{assetDateTimeOriginal.toLocaleString(locale, {weekday:'short', hour: 'numeric', minute: '2-digit', timeZoneName:'longOffset'})}
|
{assetDateTimeOriginal.toLocaleString(locale, {
|
||||||
|
weekday: 'short',
|
||||||
|
hour: 'numeric',
|
||||||
|
minute: '2-digit',
|
||||||
|
timeZoneName: 'longOffset'
|
||||||
|
})}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
export let bucketHeight: number;
|
export let bucketHeight: number;
|
||||||
export let isAlbumSelectionMode = false;
|
export let isAlbumSelectionMode = false;
|
||||||
|
|
||||||
const locale = navigator.languages;
|
const locale = navigator.language;
|
||||||
const groupDateFormat: Intl.DateTimeFormatOptions = {
|
const groupDateFormat: Intl.DateTimeFormatOptions = {
|
||||||
weekday: 'short',
|
weekday: 'short',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
@ -114,7 +114,10 @@
|
|||||||
bind:clientHeight={actualBucketHeight}
|
bind:clientHeight={actualBucketHeight}
|
||||||
>
|
>
|
||||||
{#each assetsGroupByDate as assetsInDateGroup, groupIndex (assetsInDateGroup[0].id)}
|
{#each assetsGroupByDate as assetsInDateGroup, groupIndex (assetsInDateGroup[0].id)}
|
||||||
{@const dateGroupTitle = new Date(assetsInDateGroup[0].createdAt).toLocaleDateString(locale, groupDateFormat)}
|
{@const dateGroupTitle = new Date(assetsInDateGroup[0].createdAt).toLocaleDateString(
|
||||||
|
locale,
|
||||||
|
groupDateFormat
|
||||||
|
)}
|
||||||
<!-- Asset Group By Date -->
|
<!-- Asset Group By Date -->
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -39,7 +39,7 @@ export function getBytesWithUnit(bytes: number, maxPrecision = 1): [number, stri
|
|||||||
* @returns localized bytes with unit as string
|
* @returns localized bytes with unit as string
|
||||||
*/
|
*/
|
||||||
export function asByteUnitString(bytes: number, maxPrecision = 1): string {
|
export function asByteUnitString(bytes: number, maxPrecision = 1): string {
|
||||||
const locale = Array.from(navigator.languages);
|
const locale = Array.from(navigator.language);
|
||||||
const [size, unit] = getBytesWithUnit(bytes, maxPrecision);
|
const [size, unit] = getBytesWithUnit(bytes, maxPrecision);
|
||||||
return `${size.toLocaleString(locale)} ${unit}`;
|
return `${size.toLocaleString(locale)} ${unit}`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user