• Resolved Dev49.net

    (@dev49net)


    Hi Bas,
    Your plugin is giving wrong invoice date. I don’t know how WordPress does it, but it somehow messes with PHP time() and date() function, so when you call these functions in context of WordPress, they may return wrong time. WordPress advises against using these functions – current_time() should be used instead.

    From my quick research, it turns out that problem is in abstract-bewpi-invoice.php, line 147, you have this:
    <strong>return ( !empty( $date_format ) ) ? date_i18n( $date_format, strtotime( date( $date_format ) ) ) : date_i18n( "d-m-Y", strtotime( date( 'd-m-Y' ) ) );</strong>
    Which causes my invoices to be one hour behind the real date. Replacing date() with current_time() solves the problem:
    return ( !empty( $date_format ) ) ? date_i18n( $date_format, current_time( 'timestamp' ) ) : date_i18n( "d-m-Y", current_time( 'timestamp' ) );

    You may want to browse through your code to see if you are not using date() or time() in other places.

    If you could integrate it into the next release, that would be fantastic 🙂

    Once again, thank you for your fantastic plugin and support 🙂

    Cheers,
    Dan

    https://ww.wp.xz.cn/plugins/woocommerce-pdf-invoices/

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

The topic ‘Wong invoice date’ is closed to new replies.