WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. knireis
    Member
    Posted 1 year ago #

    I tested latest 1.4.9.2 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.

    http://wordpress.org/extend/plugins/participants-database/

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    knireis,

    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
    Member
    Posted 1 year 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.
    Thanks!

  4. KleinBloemetje
    Member
    Posted 11 months ago #

    Hai,

    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
    Member
    Posted 11 months ago #

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

    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
    Member
    Plugin Author

    Posted 11 months 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

About this Topic

Tags

No tags yet.