I'm not sure whether I should post this with Date module or here.

I can't get date tokens to render at all - searched the issue queue, but couldn't find anything relevant, although I'd say this would affect a lot of people if it was actually a bug....hence a support request.

Below is a simple testing rule. The event node has a date field "field_event_date" and an integer "field_capacity". I've brought both fields into scope via "Entity has field" and can select both in the data selector. The date field only wants to give me "node:field-event-date:duration", though...rather than "node:field-event-date:value". Capacity works as expected when I view an event node, but both date tokens are ignored.

{ "rules_date_token_test" : {
    "LABEL" : "Date token test",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_view" ],
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_event_date" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_event_capacity" } }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "Testing tokens...Duration: [node:field-event-date:duration], Date value: [node:field-event-date:value], Capacity: [node:field-event-capacity]" } }
    ]
  }
}

Comments

nicolash’s picture

Component: Rules Core » Rules Engine
Status: Active » Closed (fixed)

Ok, so this is more a Date/Token/Entity Token issue... #1103032: Document how to use date tokens