I have several date fields (Date_api 7.x-2.6) I don't seem to be able to get any of them to be replaced, even though they have values. For example [node:field-po-approval-date:value]; I have tried it both with dashes and with underscores. What am I doing wrong?

Comments

NancyDru’s picture

This is a date field with end dates and multiple values. I think the other dates are single value and without end dates. For those dates, I get options to specify the format, etc. and they do display. But the date I'm having trouble with does not have such options. But I do see "The following properties may be appended to the token: value (Start date), value2 (End date), duration (Duration)". My message includes "dates: [node:field-tentative-dates:value] to [node:field-tentative-dates:value2]" and it comes out with blank values even though the node does have dates specified.

NancyDru’s picture

Project: Token » Date
Version: 7.x-1.5 » 7.x-2.x-dev
Component: User interface » Date Field

Moving to Date

caspervoogt’s picture

I have exactly the same issue and have had it before on other projects. My only solution was to have one field for the start date and another for the end date, with no option for specifying an end date in either one. Not ideal ... and it makes it difficult to work with the Calendar module among other things. Don't know what the real solution is, but as it is now, "The following properties may be appended to the token: value (Start date), value2 (End date), duration (Duration)" is incorrect, for me and you at least. Even if the value did manage to get into the URL, we would still need format options, e.g. "custom" so you could format it as yyyy-mm-dd for example.

wickwood’s picture

Thanks starting this issue. No I know it's not me and not crazy, although trying to figure out why I wasn't getting any values for my date field tokens nearly drove me over the edge today.

At least now I know what the problem is and perhaps someday someone will figure out an answer to this issue. I'll certainly do what I can to help!

wickwood’s picture

Category: Support request » Bug report

Changing this to a bug report.

Just clarify, tokens are not available for date fields when there the field is configured to collect an end date.

Tokens are generated (are far as I can tell) when date field is configured to repeat and/or have unlimited values. I haven't yet tested this completely, however I do see the expected tokens listed in the list of available tokens.

wickwood’s picture

This problem also exists (as far as I can tell) with and without the Entity Tokens Module being enabled.

Apparently in order to get custom dates you need Entity Tokens enabled.

wickwood’s picture

I found a patch for Entity module (with submodule Entity Tokens) which helped me solve this problem at least for date fields with starting and end dates. It doesn't solve the problem if you a have repeating date field.

See my solution in the Entity API issue cue as comment #21 in the Support list type tokens issue.

simohell’s picture

I was looking for a solution to similar problem, and searching through the issues it took some time for me to figure out (trial and error, more or less) how to do a multivalue field token. The instructions say this

[commerce-product:field-dates:?] Field "field_dates". The following properties may be appended to the token: value (Start date), value2 (End date), duration (Duration)

But acutally, to get the start date I just needed to add a 0 in between.
[commerce-product:field-dates:0:value]

iamkirkbater’s picture

I only have one value in my date field, but it has a start and end date. Here is the token combination that I needed to use to obtain a single value:

[node:field-date:value:custom:Y]

tammo’s picture

I tried to use this peculiar token format in a rule, but unfortunately it did not work.

[node:field-date:value:custom:Y]

I used: [entity-fetched:field-datum:value:custom:Y] when fetching a node that belongs to a registration, using the module Entity Registrations.

spgd01’s picture

I have the same problem. When using a date filed with an end date i can no longer use tokens other then value (Start date), value2 (End date), duration (Duration).

I would like to be able to use all the custom values such as : short, medium, and custom etc.

When I remove the end date value of the field I can the use all the tokens.

todea’s picture

My situation is same as #10. I'm using entity registration, rules, and trying to get a date value belonging to a node. My date field has start and end values.

This worked for me:
[entity-fetched:field-date:0:value:custom:Y-m-d]

RobertInOP’s picture

My situation is the same as #12, and todea's solution worked perfectly. Thanks!