Other date_date call replacements

This commit is contained in:
Mike Jolley 2017-03-10 16:43:05 +00:00
parent 8ab839a030
commit 53962f1143
5 changed files with 7 additions and 5 deletions

View File

@ -599,6 +599,8 @@ abstract class WC_Data {
try {
if ( empty( $value ) ) {
$datetime = null;
} elseif ( is_a( $value, 'WC_DateTime' ) ) {
$datetime = $value;
} elseif ( is_numeric( $value ) ) {
$datetime = new WC_DateTime( "@{$value}", new DateTimeZone( 'UTC' ) );
$datetime->setTimezone( new DateTimeZone( wc_timezone_string() ) );

View File

@ -193,13 +193,13 @@ class WC_Meta_Box_Order_Data {
if ( $order->get_date_paid() ) {
/* translators: 1: date 2: time */
printf( ' ' . __( 'on %1$s @ %2$s', 'woocommerce' ), date_i18n( get_option( 'date_format' ), $order->get_date_paid() ), date_i18n( get_option( 'time_format' ), $order->get_date_paid() ) );
printf( ' ' . __( 'on %1$s @ %2$s', 'woocommerce' ), wc_format_datetime( $order->get_date_paid() ), wc_format_datetime( $order->get_date_paid(), get_option( 'time_format' ) ) );
}
echo '. ';
}
if ( $ip_address = get_post_meta( $post->ID, '_customer_ip_address', true ) ) {
if ( $ip_address = $order->get_customer_ip_address() ) {
/* translators: %s: IP address */
printf(
__( 'Customer IP: %s', 'woocommerce' ),

View File

@ -14,7 +14,7 @@ $who_refunded = new WP_User( $refund->get_refunded_by() );
<td class="name">
<?php
/* translators: 1: refund id 2: date */
printf( __( 'Refund #%1$s - %2$s', 'woocommerce' ), $refund->get_id(), date_i18n( get_option( 'date_format' ) . ', ' . get_option( 'time_format' ), $refund->get_date_created() ) );
printf( __( 'Refund #%1$s - %2$s', 'woocommerce' ), $refund->get_id(), wc_format_datetime( $order->get_date_created(), get_option( 'date_format' ) . ', ' . get_option( 'time_format' ) ) );
if ( $who_refunded->exists() ) {
echo ' ' . esc_attr_x( 'by', 'Ex: Refund - $date >by< $username', 'woocommerce' ) . ' ' . '<abbr class="refund_by" title="' . sprintf( esc_attr__( 'ID: %d', 'woocommerce' ), absint( $who_refunded->ID ) ) . '">' . esc_attr( $who_refunded->display_name ) . '</abbr>' ;

View File

@ -133,7 +133,7 @@ class WC_Report_Customer_List extends WP_List_Table {
if ( ! empty( $orders ) ) {
$order = $orders[0];
return '<a href="' . admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) . '">' . _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() . '</a> &ndash; ' . date_i18n( get_option( 'date_format' ), $order->get_date_created() );
return '<a href="' . admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) . '">' . _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() . '</a> &ndash; ' . wc_format_datetime( $order->get_date_created() );
} else {
return '-';
}

View File

@ -387,7 +387,7 @@ class WC_Structured_Data {
$markup['url'] = $order_url;
$markup['orderStatus'] = isset( $order_status[ $order->get_status() ] ) ? $order_status[ $order->get_status() ] : '';
$markup['orderNumber'] = $order->get_order_number();
$markup['orderDate'] = date( 'c', $order->get_date_created() );
$markup['orderDate'] = $order->get_date_created()->format( 'c' );
$markup['acceptedOffer'] = $markup_offers;
$markup['discount'] = $order->get_total_discount();
$markup['discountCurrency'] = $order->get_currency();