Participants Database
[resolved] international date fields (6 posts)

  1. knireis
    Posted 2 years ago #

    I tested latest for the international date fields.
    When i enter a field in Dutch in format '3 maart 1965', it will not be saved (at least it is not displayed). Entering it as '3 March 1965', it is saved as '3 maart 1965', but the next save will remove the date from the field.

    I have following setting in wordpress-general: j F Y and the strict-format setting in the plugin is selected.
    Hope this helps solving it.


  2. xnau
    Plugin Author

    Posted 2 years ago #


    I have spent many hours on this problem and I don't have a solution yet. There is a PHP module that can interpret localized dates, but I have not had a chance to test it...I am planning to try to add this in the next update.

    The only thing that will work consistently for you is to use numeric dates . I'm sorry, but this problem has proven to be much more difficult to solve than I thought it would be.

  3. knireis
    Posted 2 years ago #

    No problem, i know you do all you can. I tested it with the '-' iso the '/' and that works fine now, so another step forward.

  4. KleinBloemetje
    Posted 2 years ago #


    I think I've solved this problem.
    Can you have a look at line 2404 of "participants-database.php":

    2400: if (preg_match('#^[0-9-]+$#', $string) > 0) {
    2400: if (preg_match('#^[-][0-9]+$#', $string) > 0) {

    It seems that the function "parse_date" is too loose in parsing the date offered when it is of the form "06-05-2013", i.e. containing only digits and '-' chars.
    When I remove the '-' from the regex, it only recognises strings with digits, i.e. an actual timestamp. It now also checks the first char to be an optional '-' for negative integers...

    Can you help testing whether this works?

  5. KleinBloemetje
    Posted 2 years ago #

    Testing myself, I found some more necessary updates.
    (BTW, I updated agains Version:

    Additional updates:

    File "participants-database.php", line 955:
    Replace line:
    //$return = empty($value) ? '' : date_i18n(get_option('date_format'), self::parse_date($value));
    With line:
    $return = empty($value) ? '' : self::parse_date($value);

    File "FormElement.class.php", line 1022:
    Add lines:

    $time = preg_match( '#^[-][0-9]+$#', $timestamp ) > 0 ? (int) $timestamp : strtotime( $timestamp );
    $display_value = $timestamp == '0000-00-00 00:00:00' ? '' : date_i18n( get_option('date_format','r'), $time );
    return $display_value;

    Hope this helps...

  6. xnau
    Plugin Author

    Posted 2 years ago #

    Thanks, I've completely reworked this whole section of the code...I totally missed that problem with the regex, though. good catch!

    I'm going to take a look at your second set of suggestions....thanks for sharing that!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Participants Database
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.