I have a plugin that uses a datetime variable to record a class start time. When I save the training record the time is changed from local MDT to GMT into the database, and when displayed again it is six hours off. Changing the form as follows fixes the problem:

{{ forms.timeField({ id: 'classTime', required: false, name: 'training[classTime]', value: training.classTime ? training.classTime|date_modify("+6 hour") : null, errors: training.errors ? training.errors('classTime') : null, }) }}

I notice my training dates are also impacted. Listing date on index.html shows one day prior, but the database stores values correctly.

Where and when do I fix dates coming and going from the mysql store?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.