woocommerce / woocommerce-product-tables-feature-plugin

Implements new data-stores and moves product data into custom tables, with a new, normalised data structure.
GNU General Public License v3.0
192 stars 32 forks source link

Sale price scheduled dates get changed during migration #134

Open leewillis77 opened 6 years ago

leewillis77 commented 6 years ago

The migration of sale price scheduled dates goes awry and it looks like it's out because it's taking timezones into account whereas the store data is UTC (I think).

Data before migration:

mysql > SELECT * from wc_postmeta WHERE meta_id IN (255,256);
+---------+---------+------------------------+--------------+
| meta_id | post_id | meta_key               | meta_value   |
+---------+---------+------------------------+--------------+
|     255 |      23 | _sale_price_dates_from | 1538348400   |
|     256 |      23 | _sale_price_dates_to   | 1561849200   |

Which is displayed in the UI as: screenshot 2018-10-26 14 38 39

Data after migration:

mysql> select date_on_sale_from, date_on_sale_to from wc_wc_products where product_id = 23 \G ;
*************************** 1. row ***************************
date_on_sale_from: 2018-09-30 23:00:00
  date_on_sale_to: 2019-06-29 23:00:00
1 row in set (0.00 sec)

Which is displayed in the UI as:

screenshot 2018-10-26 14 38 46

WordPress' timezone is set to "London" (Currently UTC+1)