From: Kurund Jalmi Date: Fri, 3 Nov 2023 18:23:24 +0000 (+0000) Subject: set default date on the frontend X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9361b32cef5cd5ec2172c721481485bd3b230526;p=civicrm-core.git set default date on the frontend --- 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);