From bbaec2e50f9cdb682c2144e1d9b693dd5fb7bfb3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 14 Apr 2022 09:46:46 +0100 Subject: [PATCH] Add on change action to datetime field --- .../src/components/app/forms/DateTimeField.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/app/forms/DateTimeField.svelte b/packages/client/src/components/app/forms/DateTimeField.svelte index 022a634bc5..1010883cad 100644 --- a/packages/client/src/components/app/forms/DateTimeField.svelte +++ b/packages/client/src/components/app/forms/DateTimeField.svelte @@ -10,9 +10,17 @@ export let timeOnly = false export let validation export let defaultValue + export let onChange let fieldState let fieldApi + + const handleChange = e => { + fieldApi.setValue(e.detail) + if (onChange) { + onChange({ value: e.detail }) + } + } fieldApi.setValue(e.detail)} + on:change={handleChange} disabled={fieldState.disabled} error={fieldState.error} id={fieldState.fieldId}