Closed (duplicate)
Project:
Token
Version:
5.x-1.10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
6 Dec 2007 at 09:58 UTC
Updated:
6 Mar 2010 at 17:33 UTC
Jump to comment: Most recent file
I've noticed Pathauto annoyingly uses the server time to generate a creation date/time -- as opposed to going through Drupal's own time zone filter which uses the /admin/settings/date-time setting.
If I get the time to look at it, I will, but unfortunately that won't be for a while, so I thought I'd file a bug report to at least make you aware of the issue, as it sure would be a helpful fix.
Apologies if this is a duplicate.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | token_format_date_support_5.x-1.10.patch | 3.43 KB | meatbites |
| #6 | token_format_date_support_1.patch | 3.51 KB | meatbites |
| #2 | token_format_date_support.patch | 3.71 KB | meatbites |
Comments
Comment #1
gregglesThis is a bug against token module probable. token_node.inc would be the file to look at.
Questions: should the token use the site time zone? The time zone of the user creating the node? The time zone of the user editing the node?
I agree that "server time" is wrong, but I'm not sure there is an easy answer on which is right. Perhaps the api for making timezone adjusted dates takes a lot of this into account already. I haven't looked.
Comment #2
meatbites commentedWith this patch, Token now takes advantage of Drupal's format_date. This addresses both the lack of timezone support and any other time and date settings Drupal may have both now and in future.
Toggling user-configurable timezones is indeed an option already built into Drupal. A further option specific to Token could probably be added later, but I think that's a feature outside of this issue as the functionality is already there.
Comment #3
Christefano-oldaccount commentedsubscribing
Comment #4
meatbites commentedI just had a quick play. The following might pave way to a better implementation, as I'm not sure the multiple calls to format_date is entirely efficient. I've not yet tested this under token.
Thoughts?
Comment #5
meatbites commentedAnother quick fiddle -- this would be close to the final version, I'd think. I'll eventually get to properly testing this and putting it into a patch, unless someone beats me to it.
Comment #6
meatbites commentedSee attached patch for the final working version of my above code. It's slightly faster than calling drupal_format multiple times.
Note: I added back the conditionals originally inserted here that leave the dates empty if they're not needed. These seemed to mysteriously disappear from HEAD -- was this intentional? If so, I'll rework a patch without the function.
Comment #7
meatbites commentedRe-rolled the patch to suit Token 5.x-1.10.
Additional:
- Added (int) cast to incoming date (as per this version of Token).
- Minor whitespace fix.
Comment #8
dave reidBetter patch for the current version in #307520: Date formatting function so I'm marking this as a duplicate of that issue.