Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a date field on a node type. This date field is set to have a from and a to date. The granularity is down to the minute.
I have my node title, via Automatic Nodetitles, set to be this: [field_date-month] [field_date-yyyy]
.
No matter what date I have in the field, the value that ends up in the node title is January 2007.
I am using a Datestamp field to do this.
Comments
Comment #1
Aren Cambre CreditAttribution: Aren Cambre commentedJust now, I tried using [field_date-timestamp] and [field_date-to-timestamp]. In both cases, the resulting date code is 1167609600, which is Mon, 01 Jan 2007 00:00:00 GMT.
I also tried a couple of additional replacement patterns, and it appears that no matter what I use, the returned value will be based off 1167609600.
Comment #2
Aren Cambre CreditAttribution: Aren Cambre commentedWow, something is really messed up. I just created a Date field type (in addition to the previously-created Datestamp field type), and it too appears to return all values based off timestamp 1167609600.
Comment #3
Aren Cambre CreditAttribution: Aren Cambre commentedI may have found the problem. token_cck.inc (line 263) calls
date_show_date($date, 'Y')
. That leads to date.inc (line 487), which hasdate_format_date($format_string, date_fuzzy_stamp($date->local))
. The 2nd parameter of that function leads to execution of the following date.inc code (lines 531-545):It's uncanny how the date stamp that is used ends up having the exact same values as the else clause.
Note that the date.inc line numbers are from the Aug. 8 version of 5.x-DEV.
Comment #4
Aren Cambre CreditAttribution: Aren Cambre commentedWell, I looked more at the code, and it looks like the default date/time is only used in its entirety if the date object passed to date_fuzzy_stamp is empty?
Working backwards, it looks like this may happen if token's date_token_values's 2nd parameter ($object) is null? But grepping my entire Drupal install and searching the entire database, I cannot find any instance of use of the date_token_values function. So I am confused.
Comment #5
Aren Cambre CreditAttribution: Aren Cambre commentedI just created a new Date field and accepted all defaults (except for the one setting I had to change due to this bug), and I still get the same behavior.
(Yes, I changed the replacement patterns to use the new date field I just created.)
Comment #6
Aren Cambre CreditAttribution: Aren Cambre commented(Shortening title.)
Comment #7
Aren Cambre CreditAttribution: Aren Cambre commentedI have a gut feeling this might be a problem with the Token module. Switching to Token.
Comment #8
amanire CreditAttribution: amanire commentedI'm having the same problem with every date or time sensitive field except for [field_(cck field)-value] and [field_(cck field)-view]. This seems pretty vital, considering that the timestamp token is the only way to represent a time field, without branching from the module code.
Comment #9
Aren Cambre CreditAttribution: Aren Cambre commentedSo you're saying this happens with modules other than Date?
Comment #10
amanire CreditAttribution: amanire commentedNo, sorry if I was unclear. The problem for me really is using the [field_(cck date field)-timestamp] token, where (cck date field) is one of several cck date fields that I'm using. I don't know whether the bug is originating in the Date module or in the Token module.
Comment #11
amanire CreditAttribution: amanire commentedI think this may be a duplicate of this issue: http://drupal.org/node/114610
I haven't had a chance to test the patches yet, though.
Comment #12
Aren Cambre CreditAttribution: Aren Cambre commentedI think you're right. I've marked this one as duplicate.