Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter chamiewp

    (@chamiewp)

    Note for the dev team, you should rename the $sFormat to $phpFormat or $wpFormat.

    $sFormat and $jsFormat are really close, it’s a typo-friendly naming choice ^^

    Thread Starter chamiewp

    (@chamiewp)

    I did find the issue. 😉

    in /inc/main.inc.php:L3497

    `private function date_format_php_to_js( $sFormat ) {
    switch( $sFormat ) {
    //Predefined WP date formats
    case ‘F j, Y’:
    return( ‘MM dd, yy’ );
    break;
    case ‘F js, Y’:
    return( ‘MM dd, yy’ );
    break;
    case ‘Y/m/d’:
    return( ‘yy/mm/dd’ );
    break;
    case ‘m/d/Y’:
    return( ‘mm/dd/yy’ );
    break;
    case ‘d/m/Y’:
    return( ‘dd/mm/yy’ );
    break;
    default:
    $jsFormat = preg_replace( ‘/F/’, ‘MM’, $sFormat );
    $jsFormat = preg_replace( ‘/S/’, ”, $sFormat );
    $jsFormat = preg_replace( ‘/d/’, ‘dd’, $jsFormat );
    $jsFormat = preg_replace( ‘/j/’, ‘dd’, $jsFormat );
    $jsFormat = preg_replace( ‘/Y/’, ‘yy’, $jsFormat );
    $jsFormat = preg_replace( ‘/m/’, ‘mm’, $jsFormat );
    $jsFormat = str_replace(‘ ‘, ‘ ‘,$jsFormat);
    return $jsFormat;
    }
    }`

    The variable $jsFormat is override by the second preg_replace

    Should be :

    `private function date_format_php_to_js( $sFormat ) {
    switch( $sFormat ) {
    //Predefined WP date formats
    case ‘F j, Y’:
    return( ‘MM dd, yy’ );
    break;
    case ‘F js, Y’:
    return( ‘MM dd, yy’ );
    break;
    case ‘Y/m/d’:
    return( ‘yy/mm/dd’ );
    break;
    case ‘m/d/Y’:
    return( ‘mm/dd/yy’ );
    break;
    case ‘d/m/Y’:
    return( ‘dd/mm/yy’ );
    break;
    default:
    $jsFormat = preg_replace( ‘/F/’, ‘MM’, $sFormat );
    $jsFormat = preg_replace( ‘/S/’, ”, $jsFormat );
    $jsFormat = preg_replace( ‘/d/’, ‘dd’, $jsFormat );
    $jsFormat = preg_replace( ‘/j/’, ‘dd’, $jsFormat );
    $jsFormat = preg_replace( ‘/Y/’, ‘yy’, $jsFormat );
    $jsFormat = preg_replace( ‘/m/’, ‘mm’, $jsFormat );
    $jsFormat = str_replace(‘ ‘, ‘ ‘,$jsFormat);
    return $jsFormat;
    }
    }`

    Thread Starter chamiewp

    (@chamiewp)

    Could you reproduce?

    Thread Starter chamiewp

    (@chamiewp)

    Yes the one in the WP dashboard (user)

Viewing 4 replies - 1 through 4 (of 4 total)