- Issue created by @sgroundwater
- π©πͺGermany jurgenhaas Gottmadingen
This is very nice @sgroundwater, thanks for sharing this.
With all that gained knowledge, I wonder if you make suggestions on how to enhance the
Tamper: Unix timestamp to Date
such that it would accept a timezone field as an additional config argument. If provided, it should then assume that the given timestamp is UTC and that the date should be re-calculated for the given timezone. Just came across that though as e.g. some areas in India have timezones like+4:30
where the calculation would have to be extended to cover that too ;-) - πΊπΈUnited States sgroundwater
@jurgenhass - thanks for the improvement suggestions. (My solution is just a "hack" and is far from optimal or user friendly.)
It looks like there may already be be some work in this direction of your suggestion. I'm reviewing this patch as an option.https://www.drupal.org/project/tamper/issues/3268276 β¨ Time offset tamper Needs work
- π©πͺGermany jurgenhaas Gottmadingen
Your solution is certainly more than a hack, it is really solving the problem and once that stage is being reached, it's often time to review and continue improvement.
The link to that issue in the tamper module is a good match. It looks like they are approaching it with mathematical steps there too, but it could be done with date and time tools more efficiently, I guess. Will post a comment over there and link back to here, so that they get an alternative idea.
- πΊπΈUnited States sgroundwater
RE " but it could be done with date and time tools more efficiently " Yes, I agree.
I just did a quick review test of the patch linked above. While not perfect, it does work. The problem with this patch is that it does not account for DST changes. The date calculation is hard-coded with for a specific number of hours, it does not change based on the time of the year. This patch was really designed for use with Feeds, where the DST offset might not be a showstopper. I am going to take some time to see if I can build on this patch to suite our needs.
- πΊπΈUnited States sgroundwater
So a few updates to report. Over in the Tamper module, I just posted an updated patch for a TimeZone Tamper (TimeOffset).
With this patch, a new tamper "TAMPER : TIME_OFFSET" is available. This patch allows you to set a UTC time into any timezone you choose. So you can do things like show a date in two different zones. The patch is failing, probably because of a lack of tests. I'll push on to clean things up.One additional tip, when working dates, there are three places to be mindful of. System Regional Timezone, a field display's timezone, or a user's local timezone. This took me a bit of time confirming how these settings affect things. (ECA ig grabbing the UTC value from the database.) Dates in the database are stored as UTC without a timezone. For my sites, I'm setting the Regional Timezone as "New York", there is no timezone on my date field, and my local timezone is set to "New York".
https://www.drupal.org/project/tamper/issues/3268276 β¨ Time offset tamper Needs work
- Status changed to Postponed: needs info
over 1 year ago 9:02am 13 July 2023 - π©πͺGermany jurgenhaas Gottmadingen
@sgroundwater has there been any update on this?
- Status changed to Fixed
over 1 year ago 1:47pm 3 August 2023 Automatically closed - issue fixed for 2 weeks with no activity.