-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add utility function to handle dates timezone conversions #108
Comments
Cool. I think the 1st step here is a survey of what timezone-related code we have in our extensions so we can figure out what would be most helpful to abstract into a framework helper. |
I'll add my vote for this, since I'm basically doing all the same date manipulations, formatting, parsing in PDF Vouchers as well :) |
another use case appeared in Local Pickup Plus, as setting a pickup deadline or lead time needed time zone handling to ensure the right days on the pickup appointment calendar were selectable the fix consisted of adopting a similar solution as Memberships to adjust a timestamp by timezone |
Note: given the FW is now using PHP 5.3, and soon 5.4, perhaps in plugins we should rather switch to use native |
Most of the time we store dates and time in UTC. But then we have cases were the site timezone is disregarded (Memberships for example) and thus there might be some discrepancy in what the users see (thinking that's date-time in their timezone) and what the extension actually handles, a different time offset.
Storing time in UTC is fine, but we might want to have a shared function to help out with timezone offsets. Eventually we might also want to convert one date in one timezone to another.
So we have four factors: date-time, date-time format, timezone to convert from (UTC or other?), timezone to convert to.
For memberships I was going for something along these lines but it can be adapted (this function assumes the date format Memberships uses and also it only converts from UTC)
The text was updated successfully, but these errors were encountered: