This is a followup to my previous question. Previously, I had an issue where the customer created_at attribute was incorrectly assigned a datetime input filter when it should have been date.

However, I still cannot save a customer because of the way Magento is parsing the date.


public function inputFilter($value)
    $filterInput = new \Zend_Filter_LocalizedToNormalized(
        ['date_format' => $this->_dateFormat, 'locale' => $this->localeResolver->getLocale()]
    $filterInternal = new \Zend_Filter_NormalizedToLocalized(
        ['date_format' => DateTime::DATE_INTERNAL_FORMAT, 'locale' => $this->localeResolver->getLocale()]

    $value = $filterInput->filter($value);
    print_r($value) // 2013-07-18 04:00:00
                    // ^ Date is OK!
    $value = $filterInternal->filter($value);
    print_r($value) // 013,-07,-18, 04,:00,:00
                    // ^ Woah, what happened?!
    return $value;

So, why does Zend_Filter_NormalizedToLocalized completely destroy my date format and prevent me from saving Customers?


To solve this problem short-term, I commented out the line:

 $value = $filterInternal->filter($value);

and faced no adverse effects.

Later, I discovered that going into the Admin and going to Customer Attributes, I could edit created_at, and turn off all validation which fixed the problem completely.

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.