Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | Capture du 2013-10-07 15:30:50.png | 37.75 KB | pfx |
#1 | 991830-1-date-nonascii-validation-errors.patch | 653 bytes | milesw |
#1 | 991830-1-date-nonascii-validation-errors-TEST.patch | 1.07 KB | milesw |
Comments
Comment #1
milesw CreditAttribution: milesw commentedThe 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.
Comment #2
maximpodorov CreditAttribution: maximpodorov commentedMaybe it's time to commit this trivial patch.
Comment #4
maximpodorov CreditAttribution: maximpodorov commentedThe similar bug is just fixed: https://drupal.org/node/1863610#comment-7920295
Comment #5
cafuego CreditAttribution: cafuego commentedApplied 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?Comment #6
pfx CreditAttribution: pfx commentedI 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.
Comment #7
pfx CreditAttribution: pfx commentedFrom 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?...
Comment #8
cafuego CreditAttribution: cafuego commentedI'm happy to change the regex to allow for longer and longer months, but where will it end? ;-)
Comment #9
jos_s CreditAttribution: jos_s commentedFor Italian month Maggio I also need 'M' => '\S{3,6}'. Don't know where this is going to end. ;-)
Comment #10
cafuego CreditAttribution: cafuego commentedHmm, 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.
Comment #11
jos_s CreditAttribution: jos_s commentedChanging '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!