Files
DistrictCentral/imports/ui/DateInput.svelte

17 lines
351 B
Svelte
Raw Permalink Normal View History

<script>
import dayjs from 'dayjs'
export let format = 'YYYY-MM-DD'
export let date = new Date()
let internal
const input = (x) => (internal = dayjs(x).format(format))
const output = (x) => (date = dayjs(x, format).toDate())
$: input(date)
$: output(internal)
</script>
<input type="date" bind:value={internal} />