update readme and add .vscode
This commit is contained in:
20
frontend/src/components/TimeInput.svelte
Normal file
20
frontend/src/components/TimeInput.svelte
Normal file
@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { Input } from "flowbite-svelte";
|
||||
|
||||
let { value }: { value: Date } = $props();
|
||||
|
||||
const formatDateTimeLocal = (date: Date) => {
|
||||
const pad = (num) => num.toString().padStart(2, "0");
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<Input
|
||||
type="datetime-local"
|
||||
value={formatDateTimeLocal(value)}
|
||||
onchange={(e) => {
|
||||
// @ts-ignore
|
||||
value = new Date(e.target.value);
|
||||
}}
|
||||
required
|
||||
/>
|
Reference in New Issue
Block a user