Fix usage of binding values to datepickers

This commit is contained in:
Andrew Kingston 2021-10-19 14:04:12 +01:00
parent 9deb9be1cd
commit 7924a69016
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
<script> <script>
import Field from "./Field.svelte" import Field from "./Field.svelte"
import DatePicker from "./Core/DatePicker.svelte" import DatePicker from "./Core/DatePicker.svelte"
import { createEventDispatcher } from "svelte"
export let value = null export let value = null
export let label = null export let label = null
@ -10,6 +11,13 @@
export let enableTime = true export let enableTime = true
export let placeholder = null export let placeholder = null
export let appendTo = undefined export let appendTo = undefined
const dispatch = createEventDispatcher()
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}
</script> </script>
<Field {label} {labelPosition} {error}> <Field {label} {labelPosition} {error}>
@ -20,6 +28,6 @@
{placeholder} {placeholder}
{enableTime} {enableTime}
{appendTo} {appendTo}
on:change on:change={onChange}
/> />
</Field> </Field>