From 9361b32cef5cd5ec2172c721481485bd3b230526 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Fri, 3 Nov 2023 18:23:24 +0000 Subject: [PATCH] set default date on the frontend --- ext/afform/core/ang/af/afField.component.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/afform/core/ang/af/afField.component.js b/ext/afform/core/ang/af/afField.component.js index 60223ed607..c8c56c6e72 100644 --- a/ext/afform/core/ang/af/afField.component.js +++ b/ext/afform/core/ang/af/afField.component.js @@ -123,6 +123,10 @@ else if (ctrl.afFieldset.getStoredValue(ctrl.fieldName) !== undefined) { setValue(ctrl.afFieldset.getStoredValue(ctrl.fieldName)); } + else if ('default_date_type' in ctrl.defn && ctrl.defn.default_date_type === 'now') { + let currentDate = new Date(); + setValue(currentDate.toISOString().split('T')[0]); + } // Set default value based on field defn else if ('afform_default' in ctrl.defn) { setValue(ctrl.defn.afform_default); -- 2.25.1