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 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
Comment #1
NancyDruThis 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.
Comment #2
NancyDruMoving to Date
Comment #3
caspervoogt CreditAttribution: caspervoogt commentedI 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.
Comment #4
wickwood CreditAttribution: wickwood commentedThanks 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!
Comment #5
wickwood CreditAttribution: wickwood commentedChanging 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.
Comment #6
wickwood CreditAttribution: wickwood commentedThis 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.
Comment #7
wickwood CreditAttribution: wickwood commentedI 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.
Comment #8
simohell CreditAttribution: simohell commentedI 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
But acutally, to get the start date I just needed to add a 0 in between.
[commerce-product:field-dates:0:value]
Comment #9
iamkirkbater CreditAttribution: iamkirkbater commentedI 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]
Comment #10
tammo CreditAttribution: tammo as a volunteer commentedI 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.
Comment #11
spgd01 CreditAttribution: spgd01 commentedI 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.
Comment #12
todea CreditAttribution: todea commentedMy 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]
Comment #13
RobertInOP CreditAttribution: RobertInOP commentedMy situation is the same as #12, and todea's solution worked perfectly. Thanks!