nextcloud/forms

Date field not respecting locale of the user when entering the date manually (not using the date picker)

Janosch opened this issue ยท 1 comments

Please use the ๐Ÿ‘ reaction to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug
We recently used the date field in a form for a group of people in Germany. 80% of the dates entered were garbage, as the users expected to enter the date in German locale: dd.mm.YYYY. Because forms parse a date as YYYY-mm-dd disregarding the locale, the wrong date is stored.

A German date entered as 22.11.1992 is stored as 19.11.2022.

To Reproduce
Steps to reproduce the behavior:

  1. Set "default_locale" => "de_DE"
  2. Create a form with a date field
  3. Enter a german date manually, not using the date picker, e.g. 22.11.1992
  4. Save form
  5. Verify that the date stored is 19.11.2022

Expected behavior
The date should be parsed in the locale of the user. In case of an anonymous user it should be parsed in the default locale.

Nextcloud (please complete the following information):

  • Nextcloud-Version: 27.1.1.0
  • Forms-Version: unknown, tba

Desktop (please complete the following information):

  • OS: macOS 14.2.1
  • Safari 17.2.1

@Janosch thanks for reporting this, I can reproduce it here...