From bab4d9c7e3d18b0d65b055ae19e0405a97868d2e Mon Sep 17 00:00:00 2001 From: Agus Hilman Date: Fri, 4 Oct 2024 17:06:38 +0700 Subject: [PATCH] Fixed can paste value into read-only date field --- .../enketo-core/src/widget/date/datepicker-extended.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/enketo-core/src/widget/date/datepicker-extended.js b/packages/enketo-core/src/widget/date/datepicker-extended.js index 6febee311..7e7e9a302 100644 --- a/packages/enketo-core/src/widget/date/datepicker-extended.js +++ b/packages/enketo-core/src/widget/date/datepicker-extended.js @@ -87,7 +87,12 @@ class DatepickerExtended extends Widget { _setChangeHandler($fakeDateI) { const { settings } = this; - $fakeDateI.on('change paste', (e) => { + let changeEvent = 'change'; + if (!$fakeDateI.closest('label').hasClass('readonly')) { + changeEvent += ' paste'; + } + + $fakeDateI.on(changeEvent, (e) => { let convertedValue = ''; let value = e.type === 'paste'