You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
time_picker field would adjust the value displayed in the field based on OS/browser timezone ie. will not display the value stored in the DB, but treats that value as if it was UTC and the displayed value was local. Value in store is correct so it should be something related to frontend/flatpickr.js.
Edit: date_picker with time is also affected.
Steps to reproduce
Set your OS timezone to something other than UTC and compare DB stored value and the field.
Expected result
No timezone adjustment
Actual result
Value in field offset by timezone
Versions
Twill version: 2.3.0
Laravel version: 10
The text was updated successfully, but these errors were encountered:
It's probably because in DatePicker.vue on line 152 date-fns.parse is called with date + 'Z' and format + 'X' so the parsed value would be offset. Removing the Z (and since it's not needed anymore, also the X from format) seems to resolve the issue.
Edit: Had to also edit flatpickr format on line 135 to dateFormat: self.enableTime ? 'Y-m-d H:i' : 'Y-m-d' to completely resolve the problem.
galingong
changed the title
Time picker adjusts time based on timezone
Time and date picker adjusts time based on timezone
Mar 24, 2024
Description
time_picker
field would adjust the value displayed in the field based on OS/browser timezone ie. will not display the value stored in the DB, but treats that value as if it was UTC and the displayed value was local. Value in store is correct so it should be something related to frontend/flatpickr.js.Edit:
date_picker
with time is also affected.Steps to reproduce
Set your OS timezone to something other than UTC and compare DB stored value and the field.
Expected result
No timezone adjustment
Actual result
Value in field offset by timezone
Versions
Twill version: 2.3.0
Laravel version: 10
The text was updated successfully, but these errors were encountered: