Im Currently getting the merchello offer system up and running in a test environment and I've noticed some weird behaviour with the active dates when saving an offer.
The issue is that it takes the date from the datepicker and in the dateHelper.service.js it creates a new date object using date provided with no time and then calls toISOString(); on that date. This causes the date to be saved at the date before. So for example a date of 27/06/2018 in BST would first create a new date object with the value of 27/06/2018T00:00:00 with a timezone of BST +1. When it calls the iso string it deduct the +1 of leaving you with a date of 26/06/2018T23:00:00 saved in the database.
On load the +1 is not readded to give the correct date, instead the time is wiped off so you end up with 26/06/2018T00:00:00, the offset is the applied to this which gives you 26/06/2018T01:00:00 and then wiped again to go into the datepicker. The main bit here happens in the offerSettingsDisplayBuilder.js fromatDateString(val) method
This means even if you do not alter the date, every time you save the offer the offer start and end date will go one day back in the future. Should the dates not be saved as GMT and then timezone offsets applied to this? Is there a setting i can configure to stop this or is it a bug with merchello?
Offer active dates issues with timezones
Hi
Im Currently getting the merchello offer system up and running in a test environment and I've noticed some weird behaviour with the active dates when saving an offer.
The issue is that it takes the date from the datepicker and in the dateHelper.service.js it creates a new date object using date provided with no time and then calls toISOString(); on that date. This causes the date to be saved at the date before. So for example a date of 27/06/2018 in BST would first create a new date object with the value of 27/06/2018T00:00:00 with a timezone of BST +1. When it calls the iso string it deduct the +1 of leaving you with a date of 26/06/2018T23:00:00 saved in the database.
On load the +1 is not readded to give the correct date, instead the time is wiped off so you end up with 26/06/2018T00:00:00, the offset is the applied to this which gives you 26/06/2018T01:00:00 and then wiped again to go into the datepicker. The main bit here happens in the offerSettingsDisplayBuilder.js fromatDateString(val) method
This means even if you do not alter the date, every time you save the offer the offer start and end date will go one day back in the future. Should the dates not be saved as GMT and then timezone offsets applied to this? Is there a setting i can configure to stop this or is it a bug with merchello?
is working on a reply...