I have one new customer attribute for that I have added it in checkout page by extending LayoutProcessor's public function

afterProcess(\Magento\Checkout\Block\Checkout\LayoutProcessor $subject, array $jsLayout){
$customField1 = [
            'component' => 'Magento_Ui/js/form/element/abstract',
            'config' => [
                // customScope is used to group elements within a single form (e.g. they can be validated separately)
                'customScope' => 'shippingAddress.custom_attributes',
                'customEntry' => null,
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/date',
                'options' => [
                    'changeYear'=> true,
                    'changeMonth'=> true,
                    'yearRange' => '-120y:c+nn',
                    'maxDate' => '-1d'
            'dataScope' => 'shippingAddress.custom_attributes.dob',
            'provider' => 'checkoutProvider',
            'validation' => [
                'required-entry' => false
            'options' => [],
            'filterBy' => null,
            'customEntry' => null,
            'visible' => true,
            'disabled' => $disabled,
            'value' => "11/6/1997" // value field is used to set a default value of the attribute 

But on frontend I can see like this

enter image description here


Try adding the 'dateFormat' => 'MM/dd/y' to the options array in config (after, 'maxDate' => '-1d'). In my case it seems to have fixed the issue.

Hope it will help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.