Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
108 stars 20 forks source link

Check HPOS feauture before quering DB for labels report #2827

Open samnajian opened 1 week ago

samnajian commented 1 week ago

Description

This PR adds support for HPOS in shipping labels report. It also fixes a bug that prevented the query to include the whole days on the borders of the query range.

Related issue(s)

https://github.com/woocommerce/woocommerce-shipping/issues/923

Steps to reproduce & screenshots/GIFs

Checklist

samnajian commented 6 days ago

I think this is unrelated to this PR though. But one idea that I can think of to fix this is by making sure the timestamp is int using intval() on this line : echo esc_html( get_date_from_gmt( date( 'Y-m-d H:i:s', intval( $label['created'] / 1000 ) ) ) ); WDYT?

@iyut No I didn't, how come the dates you have have decimal? basically it indicates miliseconds, didn't know we aim for that high level of precision, you're suggesting a nice idea of using intval around it.

samnajian commented 4 days ago

I think this is unrelated to this PR though. But one idea that I can think of to fix this is by making sure the timestamp is int using intval() on this line : echo esc_html( get_date_from_gmt( date( 'Y-m-d H:i:s', intval( $label['created'] / 1000 ) ) ) ); WDYT?

Addressed in a15b67322c24ef93f0679713c1f1a019658b360a