Here's how to recreate it:

#1. Create a webform with date element
#2. Check "Use date picker"
#3. Date format "Long date - l, F j, Y (Monday, January 1, 2018)"
#4. Form validation - required

In form, select day between 1 to 9 (in any month).
Save the form.

Error: Date must be a valid date.

If I change the Date format (in #3) to "Medium date - D, m/d/Y (Mon, 01/01/2018)", it works.

Can someone recreate this and confirm if this is a bug?

Opinion: I think when we select the date in the picker, it shows as "Monday, January 01, 2018" instead of "Monday, January 1, 2018" with the added zero. Is that the cause? Not sure.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

omdb created an issue. See original summary.

jrockowitz’s picture

The attached webform can be used to replicate this issues and yes "Monday, January 01, 2018" is causing the validation error.

jrockowitz’s picture

Status: Active » Needs review
FileSize
1.96 KB

Attached patch fixes the issue and adds some additional comments to the "Convert a PHP date format to a jQueryUI Datepicker date format" code.

  • jrockowitz committed ce17d83 on 8.x-5.x
    Issue #2933792 by jrockowitz: Bug with long date format
    
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.