diff --git a/plugins/woocommerce-admin/client/analytics/report/coupons/table.js b/plugins/woocommerce-admin/client/analytics/report/coupons/table.js index f2ecd63d149..496c94e27e0 100644 --- a/plugins/woocommerce-admin/client/analytics/report/coupons/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/coupons/table.js @@ -13,6 +13,7 @@ import { defaultTableDateFormat } from 'lib/date'; import { formatCurrency, getCurrencyFormatDecimal } from 'lib/currency-format'; import { getNewPath, getPersistedQuery } from '@woocommerce/navigation'; import { formatValue } from 'lib/number-format'; +import { getSetting } from '@woocommerce/wc-admin-settings'; /** * Internal dependencies @@ -69,6 +70,7 @@ export default class CouponsReportTable extends Component { getRowsContent( coupons ) { const { query } = this.props; const persistedQuery = getPersistedQuery( query ); + const dateFormat = getSetting( 'dateFormat', defaultTableDateFormat ); return map( coupons, ( coupon ) => { const { amount, coupon_id: couponId, orders_count: ordersCount } = coupon; @@ -121,7 +123,7 @@ export default class CouponsReportTable extends Component { display: ( ), value: dateCreated, @@ -130,7 +132,7 @@ export default class CouponsReportTable extends Component { display: dateExpires ? ( ) : ( __( 'N/A', 'woocommerce-admin' ) diff --git a/plugins/woocommerce-admin/client/analytics/report/customers/table.js b/plugins/woocommerce-admin/client/analytics/report/customers/table.js index 21589630b3e..b7b6b104dda 100644 --- a/plugins/woocommerce-admin/client/analytics/report/customers/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/customers/table.js @@ -8,11 +8,11 @@ import { Tooltip } from '@wordpress/components'; /** * WooCommerce dependencies */ -import { defaultTableDateFormat } from 'lib/date'; import { formatCurrency, getCurrencyFormatDecimal } from 'lib/currency-format'; import { Date, Link } from '@woocommerce/components'; import { formatValue } from 'lib/number-format'; import { getAdminLink, getSetting } from '@woocommerce/wc-admin-settings'; +import { defaultTableDateFormat } from 'lib/date'; const { countries } = getSetting( 'dataEndpoints', { countries: {} } ); @@ -113,6 +113,8 @@ export default class CustomersReportTable extends Component { } getRowsContent( customers ) { + const dateFormat = getSetting( 'dateFormat', defaultTableDateFormat ); + return customers.map( ( customer ) => { const { avg_order_value: avgOrderValue, @@ -145,7 +147,7 @@ export default class CustomersReportTable extends Component { const dateLastActiveDisplay = dateLastActive ? ( ) : ( '—' @@ -154,7 +156,7 @@ export default class CustomersReportTable extends Component { const dateRegisteredDisplay = dateRegistered ? ( ) : ( '—' diff --git a/plugins/woocommerce-admin/client/analytics/report/downloads/table.js b/plugins/woocommerce-admin/client/analytics/report/downloads/table.js index 645d7f71131..39cfd20e038 100644 --- a/plugins/woocommerce-admin/client/analytics/report/downloads/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/downloads/table.js @@ -9,18 +9,18 @@ import moment from 'moment'; /** * WooCommerce dependencies */ -import { defaultTableDateFormat, getCurrentDates } from 'lib/date'; +import { getCurrentDates, defaultTableDateFormat } from 'lib/date'; import { Date, Link } from '@woocommerce/components'; import { getNewPath, getPersistedQuery } from '@woocommerce/navigation'; import { formatValue } from 'lib/number-format'; -import { getAdminLink } from '@woocommerce/wc-admin-settings'; +import { getAdminLink, getSetting } from '@woocommerce/wc-admin-settings'; /** * Internal dependencies */ import ReportTable from 'analytics/components/report-table'; -export default class CouponsReportTable extends Component { +export default class DownloadsReportTable extends Component { constructor() { super(); @@ -68,6 +68,7 @@ export default class CouponsReportTable extends Component { getRowsContent( downloads ) { const { query } = this.props; const persistedQuery = getPersistedQuery( query ); + const dateFormat = getSetting( 'dateFormat', defaultTableDateFormat ); return map( downloads, ( download ) => { const { @@ -97,7 +98,7 @@ export default class CouponsReportTable extends Component { display: ( ), value: date, diff --git a/plugins/woocommerce-admin/client/analytics/report/orders/table.js b/plugins/woocommerce-admin/client/analytics/report/orders/table.js index fcbc05ce7f4..6c6d1ff9e07 100644 --- a/plugins/woocommerce-admin/client/analytics/report/orders/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/orders/table.js @@ -9,10 +9,10 @@ import { map } from 'lodash'; * WooCommerce dependencies */ import { Date, Link, OrderStatus, ViewMoreList } from '@woocommerce/components'; -import { defaultTableDateFormat } from 'lib/date'; import { formatCurrency, renderCurrency } from 'lib/currency-format'; import { formatValue } from 'lib/number-format'; import { getSetting } from '@woocommerce/wc-admin-settings'; +import { defaultTableDateFormat } from 'lib/date'; /** * Internal dependencies @@ -104,6 +104,8 @@ export default class OrdersReportTable extends Component { getRowsContent( tableData ) { const { query } = this.props; const persistedQuery = getPersistedQuery( query ); + const dateFormat = getSetting( 'dateFormat', defaultTableDateFormat ); + return map( tableData, ( row ) => { const { currency, @@ -143,7 +145,7 @@ export default class OrdersReportTable extends Component { display: ( ), value: dateCreated, diff --git a/plugins/woocommerce-admin/client/analytics/report/revenue/table.js b/plugins/woocommerce-admin/client/analytics/report/revenue/table.js index 15315f39301..cbce02b4b81 100644 --- a/plugins/woocommerce-admin/client/analytics/report/revenue/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/revenue/table.js @@ -22,6 +22,7 @@ import { renderCurrency, } from 'lib/currency-format'; import { formatValue } from 'lib/number-format'; +import { getSetting } from '@woocommerce/wc-admin-settings'; /** * Internal dependencies @@ -110,7 +111,9 @@ class RevenueReportTable extends Component { } getRowsContent( data = [] ) { - return data.map( ( row ) => { + const dateFormat = getSetting( 'dateFormat', defaultTableDateFormat ); + + return data.map( ( row ) => { const { coupons, gross_sales: grossSales, @@ -140,7 +143,7 @@ class RevenueReportTable extends Component { display: ( ), value: row.date_start, diff --git a/plugins/woocommerce-admin/src/Loader.php b/plugins/woocommerce-admin/src/Loader.php index 3a9777bcfd7..9fab5852886 100644 --- a/plugins/woocommerce-admin/src/Loader.php +++ b/plugins/woocommerce-admin/src/Loader.php @@ -690,6 +690,7 @@ class Loader { $settings['wcVersion'] = WC_VERSION; $settings['siteUrl'] = site_url(); $settings['onboardingEnabled'] = self::is_onboarding_enabled(); + $settings['dateFormat'] = get_option( 'date_format' ); if ( ! empty( $preload_data_endpoints ) ) { $settings['dataEndpoints'] = isset( $settings['dataEndpoints'] )