Possible bug: Timezone conversion missing in export date handling
-
Hi there, I was having some sync issues and I ran the plugin through Claude Opus 4.5 Thinking to help, and it said it found this issue. Here is what it said:
File: includes/api/requests/class-wc-shipstation-api-export.php lines 74-86Issue:
$tz_offsetis calculated on line 63 but never used. The dates from ShipStation (which are in the store’s timezone) get passed tostrtotime()which interprets them as server time.Result:
For stores where WP timezone ≠ server timezone, the date range is wrong and orders fall outside the query window.Example from logs (store timezone: Australia/Brisbane, server: UTC):
Server: 02:13 UTC Request: start_date=04:12, end_date=18:13 → Exported 0 orders (04:12 hasn't happened yet in UTC)Suggested fix:
$wp_timezone = wp_timezone(); $start_dt = new DateTime( $start_date_local, $wp_timezone ); $start_dt->setTimezone( new DateTimeZone( 'UTC' ) ); $start_date = $start_dt->format( 'Y-m-d H:i:s' );Plugin version: 4.9.0
You must be logged in to reply to this topic.