The error is caused if I edit an existing order in the backend of WooCommerce which has the date accepted already stored in postmeta with the meta_key = ‘_wpgdprc’ and a date in the past, this date is not shown – instead the current date is always displayed.
This is also the case when listing orders in WooCommerce – the original accepted date is ignored and the current date is displayed against all of the orders.
To fix it, edit /plugins/wp-gdpr-compliance/Integrations/Plugins/WooCommerce.php and:
Replace line [224]:
$value = $this->getAcceptedDate( ! empty( $date ) );
with:
if($date=='') {
$value = '';
} else {
$value = Time::localDateFormat( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $date );
}
Replace line [206]:
$value = $this->getAcceptedDate( ! empty( $date ) );
with:
if($date=='') {
$value = '';
} else {
$value = Time::localDateFormat( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $date );
}
Add after line [7]:
use WPGDPRC\Utils\Time;
This also fixes the issue of any records that were in the database before the plugin was added, in which case there is no record in postmeta and so no date to check.