Drupal 7.7
Automatic Node Titles 7.x-1.0
Date 7.x-2.0-rc1
Token 7.x-1.0-beta7

I recently upgraded just the date module in the setup above, and the formatting of dates in Automatic Node Title stopped displaying correctly. If I enter a date field it is displayed in an incorrect format, for example 12/01/11T00:00:00 when it should be January 11, 2012. If I try to format the date field, the token text is set as the node title. For example, [node:field_date:custom:short] is not evaluated and is set as the actual node title.

I'm having trouble finding information so I apologize if this is actually a date or token issue. Any help is appreciated. Thanks.

Comments

richardbporter’s picture

Issue summary: View changes

Correct typo

cr@jba’s picture

I've got the same issue. Just installed Automatic Nodetitle for the first time today and 'raw' date fields display, but when you apply any formatting you get the token text.

My setup is the same as rbp, apart from me having Drupal 7.9

(Great module, by the way - just wish I'd discovered it earlier!)

[11:20 - Small update: Have just tried it with 7.x-1.x-dev and any attempt to format a date results in a blank entry]

richardbporter’s picture

Status: Active » Closed (works as designed)

Got this to work by enabling Entity Token. There is a conflict between date, token and entity token right now (I think). See http://drupal.org/node/691078

But now the day is just one day off, similar to this issue http://drupal.org/node/1197278.

StormTheGates’s picture

Having the same issue. Can you elaborate a bit more on how you solved the issue? All autonodetitles come in with 00:00:00 appended. Figure it isnt getting my custom date format.

richardbporter’s picture

After you enable Entity API and Entity Tokens, you should see a new token for the date field in the list of available tokens. It should have a hyphen instead of an underscore for the token. For example, [node:field-date] instead of [node:field_date]. Try the one with the hyphen.

StormTheGates’s picture

Thank you for the response!

I am still having problems though, currently I have installed:

Token
Date
Entity API
Entity Token

When I have Token and Entity Token enabled at the same time I get a white page error with some menu text but no info. And when token is disabled no tokens at all.

Any ideas? Running Drupal 7.12, Token RC1, and the latest Date and Entity.

Canadaka’s picture

I just started having this problem after updating a bunch of modules on my site.

I used to have it working with [node:field-bike-year:custom:Y] but it not just outputs a title as "[node:field-bike-year:custom:Y]".
In the list of available tokens I notice that the dashed version is no longer listed, only "field_bike_year". When I replace the rule using the underscore version it also does not work.

Date 7.x-2.3
Entity API 7.x-1.0-rc1
Token 7.x-1.0-rc1

It seems its the "Date" module where the problem lies or at least where there was a change that caused the problem. Its the only one of these modules that I updated, with the version from "2012-Apr-01".

willyk’s picture

I've encountered similar issues when updating the Date and Token modules. One potential solution, is to check the evaluate PHP when setting the automatic node title options and then use PHP to format the date field as desired. For instance:

print date("D. M. j/y", strtotime($node->field_your_date_filed['und'][0]['value']));

While you're not using the Custom Date formats you set in Drupal, this still gets the job done.

kruser’s picture

Great timing with that code, I needed it this morning! I made a modification to include a check for an end date:

<?php
if (isset($node->field_availability_date['und'][0]['value2']) && ($node->field_availability_date['und'][0]['value2'] != $node->field_availability_date['und'][0]['value'])):
	print date("m/d/Y", strtotime($node->field_availability_date['und'][0]['value'])) . t(' to ') . date("m/d/Y", strtotime($node->field_availability_date['und'][0]['value2']));
else:
	print date("m/d/Y", strtotime($node->field_availability_date['und'][0]['value']));
endif;
?>
lunk rat’s picture

Thank you for explaining this in #2. I used entity token and was able to get custom date formatting to work with auto_nodetitle

valiant_falstaff’s picture

#8 worked great for me, thanks! Remember to replace the six instances of the machine name of the date field in his code - field_availability_date - with the machine name of your date field, which, in Drupal 7, you can find in the "Machine Name" column of admin/structure/types/manage/[YOUR CONTENT TYPE]/fields.

rudyard55’s picture

Thanks. #4 worked for me. use the hyphenated token, not the underscored one.

rudyard55’s picture

Issue summary: View changes

Typo