mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
Merge 61ca2e9155 into a23dfff6cf
This commit is contained in:
commit
5153596f62
1 changed files with 17 additions and 0 deletions
|
|
@ -69,6 +69,23 @@
|
||||||
|
|
||||||
albumId = editingLink.album?.id;
|
albumId = editingLink.album?.id;
|
||||||
assetIds = editingLink.assets.map(({ id }) => id);
|
assetIds = editingLink.assets.map(({ id }) => id);
|
||||||
|
|
||||||
|
const expiresAt = editingLink.expiresAt ? DateTime.fromISO(editingLink.expiresAt) : DateTime.fromMillis(0);
|
||||||
|
const createdAt = DateTime.fromISO(editingLink.createdAt);
|
||||||
|
|
||||||
|
if (expiresAt) {
|
||||||
|
const remainingMs = expiresAt.toMillis() - createdAt.toMillis();
|
||||||
|
|
||||||
|
const bestOption = expiredDateOptions.reduce((best, option) => {
|
||||||
|
const diff = Math.abs(option.value - remainingMs);
|
||||||
|
const bestDiff = Math.abs(best.value - remainingMs);
|
||||||
|
return diff < bestDiff ? option : best;
|
||||||
|
});
|
||||||
|
|
||||||
|
expirationOption = bestOption.value;
|
||||||
|
} else {
|
||||||
|
expirationOption = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCreateSharedLink = async () => {
|
const handleCreateSharedLink = async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue