{"id":15541783,"date":"2022-04-08T20:48:16","date_gmt":"2022-04-08T20:48:16","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/time-slot-timestamp-does-not-adjust-for-site-timezone\/"},"modified":"2022-04-08T20:48:16","modified_gmt":"2022-04-08T20:48:16","slug":"time-slot-timestamp-does-not-adjust-for-site-timezone","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/time-slot-timestamp-does-not-adjust-for-site-timezone\/","title":{"rendered":"Time Slot timestamp does not adjust for site timezone"},"content":{"rendered":"<p>I am trying to integrate WooCommerce with Shipday and am having trouble with the selected delivery time displaying correctly in Shipday. I have isolated the problem to the <code>_orddd_lite_timeslot_timestamp<\/code> is not adjusting for the timezone of my site. Instead it is saving the timestamp as <code>UTC+0<\/code>, not <code>America\/New_York<\/code> where the site will be located. Currently this site is still in development, but here is all of the troubleshooting I have done to get me to this point.<\/p>\n<p>order-delivery-date-for-woocommerce\/includes\/class-orddd-lite-process.php<\/p>\n<pre><code>\n# current line 186\n$timestamp = strtotime( $delivery_date );\n\n# correction line 186\n$timestamp = new DateTime( $delivery_date, new DateTimeZone(wp_timezone_string()));\n\n# correction line 188\nupdate_post_meta( $order_id, &#039;_orddd_lite_timeslot_timestamp&#039;, $timestamp-&gt;format( &#039;U&#039; );\n<\/code><\/pre>\n<p>I ran this code against the original:<\/p>\n<pre><code>\n# Date: 8 April, 2020 17:00\n$strtotime_way_in_plugin === 1649437200\n$datetime_way_w_timezone === 1649451600\n<\/code><\/pre>\n<p>If there is a way I can set the timezone in the plugin let me know. Until then I will have to overwrite the plugin files.<\/p>\n<p>Thanks<\/p>\n","protected":false},"template":"","class_list":["post-15541783","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15541783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15541783\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15541783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}