When I create a node in Russian, and my date_popup powered field is configured to use date format like "12 Dec, 2010" , (so actual value entered in date field looks like "12 Дек, 2010") I get date validation errors. And, if I use more general formats like 12/12/2010, or if I switch website language to English without changing date input format, no validation errors are thrown.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

milesw’s picture

Version: 6.x-2.6 » 7.x-2.x-dev
Status: Active » Needs review
FileSize
1.07 KB
653 bytes

The same issue exists in D7 as well. The very small change to the regex in this patch fixes the issue for me. Also including a patch with a test. Solution came from a comment in #1101284: Error with August: Date format not valid when using calendar widget + catalan translation.

maximpodorov’s picture

Maybe it's time to commit this trivial patch.

Status: Needs review » Needs work

The last submitted patch, 991830-1-date-nonascii-validation-errors-TEST.patch, failed testing.

maximpodorov’s picture

cafuego’s picture

Status: Needs work » Fixed

Applied to 7.x-2.x-dev.

There is at least one more instance of preg_match being run without the u modifier in date_popup, could you check whether that need the same change?

pfx’s picture

Status: Fixed » Needs work
FileSize
37.75 KB

I just tested the latest version of the development date module.
I ulilise the french language. I get an error for the month of July.
The other months are validated.
can someone confirm.
test

pfx’s picture

From this point : http://drupal.org/node/1101284#comment-5290216 . If I made ​​the following changes in the pattern for 'M' in the function date_format_patterns() from date_api.module:

replace
'M' => '\S{3,5}'
with
'M' => '\S{3,6}'

it solves the problem because the french string 'Juill.' made 6 chars long I guess?...

cafuego’s picture

I'm happy to change the regex to allow for longer and longer months, but where will it end? ;-)

jos_s’s picture

Issue summary: View changes

For Italian month Maggio I also need 'M' => '\S{3,6}'. Don't know where this is going to end. ;-)

cafuego’s picture

Hmm, alright then :-)

Could you test something for me? Change 'M' => '\S{3,5}' to 'M' => t('\S{3,5}') and provide an Italian translation for that string in the settings.php file.

If that works, we can wrap the regexes with t() and allow a language based override as needed, rather than arbitrarily keep modifying the regexes.

jos_s’s picture

Changing 'M' => '\S{3,5}' to 'M' => t('\S{3,5}') and then providing as Italian translation '\S{3,6}' seems to work for me.

Maybe other will want do more testing, but this seems like a good way to go.

Thanks!