1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

fix(web): validation when editing asset date & time (#7160)

This commit is contained in:
Michel Heusschen 2024-02-17 15:28:34 +01:00 committed by GitHub
parent 3915867b1b
commit 60ba37b3a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 16 deletions

View File

@ -1,11 +1,3 @@
<script lang="ts" context="module">
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Intl {
type Key = 'calendar' | 'collation' | 'currency' | 'numberingSystem' | 'timeZone' | 'unit';
function supportedValuesOf(input: Key): string[];
}
</script>
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { DateTime } from 'luxon';
@ -42,7 +34,9 @@
};
let selectedDate = initialDate.toFormat("yyyy-MM-dd'T'HH:mm");
let disabled = false;
// Keep local time if not it's really confusing
$: date = DateTime.fromISO(selectedDate).setZone(selectedOption.value, { keepLocalTime: true });
const dispatch = createEventDispatcher<{
cancel: void;
@ -52,13 +46,8 @@
const handleCancel = () => dispatch('cancel');
const handleConfirm = () => {
let date = DateTime.fromISO(selectedDate);
date = date.setZone(selectedOption.value, { keepLocalTime: true }); // Keep local time if not it's really confusing
const value = date.toISO();
if (value) {
disabled = true;
dispatch('confirm', value);
}
};
@ -76,7 +65,7 @@
cancelColor="secondary"
title="Edit date & time"
prompt="Please select a new date:"
{disabled}
disabled={!date.isValid}
on:confirm={handleConfirm}
on:cancel={handleCancel}
>

View File

@ -5,7 +5,6 @@
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2020", "DOM"],
"moduleResolution": "bundler",
"module": "es2020",
"resolveJsonModule": true,