Magento2: Invalid date when customer validate with French locale

Created on 23 May 2017  路  10Comments  路  Source: magento/magento2


Preconditions


  1. Magento 2.1.5
  2. PHP 7
  3. MySQL 5.6

Steps to reproduce

  1. Set Backoffice to French locale : account settings ->language French (France)
  2. Modify a customer and set date of birthday (for example : 04/17/1973)

Expected result

  1. Customer validation with new DOB

Actual result

  1. Error message "Invalid date"


I found in Magento\Framework\Data\Form\Filter\Date class before line 65, the date value is okay, after the l.65, date value contains space chars. I think Zend_Filter_NormalizedToLocalized "filter" method insert spaces (as thousand separators). If I ignore this line, validation succeeds.

Customer Translation Fixed in 2.2.x Fixed in 2.3.x Format is valid Ready for Work bug report

Most helpful comment

Great, this is clear now, it indeed looks like a bug 馃憤

All 10 comments

Maybe I misunderstood what you meant, but the string "04/17/1973" should NOT be a valid date in the FR_fr locale: France uses DMY for all-numerical dates. So if validation fails with "04/17/1973" then that's correct for the French locale.

@gsomoza : You're right. The right date should be 17/04/1973 (dd/mm/yyyy). But javascript validation fails if I input '17/04/1973' (I obtain an error under calendar "Enter a correct date"). That's another Magento2 bug I suppose.

However, if I input '04/17/1973', Javascript validation succeeds, but PHP response fails, and I notice that space has been inserted in my date (as I explained on my additionnal informations on the issue above).

Great, this is clear now, it indeed looks like a bug 馃憤

@vjacquemin-sqli Thanks for reporting this issue. Created internal issue MAGETWO-70504 to investigate and track this issue.

Same problem with Italian locale.

Working on this issue.

Internal ticket to track issue progress: MAGETWO-80096

Hi @vjacquemin-sqli the issue has been fixed in https://github.com/magento/magento2/pull/11067 by @joachimVT
The fix will be available in 2.2.1

This issue is fixed in 2.2.1. Thanks

Hi @vjacquemin-sqli. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1353 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

  • 299109f1265fa15eeb3067e22c2638ff5907205e
  • 57318bf03bf6fe7f84b2956ffb5ecc1332bf41b3
  • 41cd961a217d30c4b7b051a775902c4fb40b84ea
  • 076b90398852478d93d1444f936ac483b4640a82
  • 435a6c200cd548b8765e5bc73b0458039a58645d
  • 5d174b873f8ba369d6504fb9d7ef30296816e2b1
  • a47b10dce854a2d21ead6b362b86ca3ddf595386
  • ab48cb176830ddab69fd1617cae96d76094ab167
  • 46be4c7ea59f6cfb9884f2bc5875245b1960edc6
  • eafc6f0a473547542c3ef80352dcd2be7128da87
  • 63b9e909f1173a51374d4cdfc68249baa66f0007
  • 2edfe9a30bb64f0a7e102bb335a89658b627bfad
  • ef5ddffb43a735627d09535b62fac2a41804a96a
  • 4ada797ece84c2f5eb55499e8bc3f75e0c7ef245
  • c5d9a019b0d51a51b452fd99b527e3b894874be2
  • 72e9e0732b98ea5b8f47bddc781dc47c688c3c58
  • 215180de0a3f6c4a16e02205732bfe8670293ad2
  • 685d50625b68dbb960988a6bfbbfc14455a6cb9e

The fix will be available with the upcoming 2.3.0 release.

Was this page helpful?
0 / 5 - 0 ratings