Hi,

I am trying to create partial date field with rules. But, I am unable to see the partial date field in rules. How do I go about creating a partial date in the node through rules? I am not much of a coder, so please help!

Comments

g1r1p1 created an issue.

g1r1p1’s picture

Bumping this. Any help would be really appreciated.

GreenChristian’s picture

Having the same issue. After a little bit of testing, here's a bit more detail on what seems to be happening:

Partial date fields are not valid input in the selector (i.e. you can't use them as the basis for a rules condition or a rules action). If you try to manually input the field, it throws up an error claiming it is not valid. This means that rules can't even check if the field exists, let alone be used to alter its value (which is what I would like to be able to do).

There is definitely a token available for partial date fields which can be manually input in rules to, for example, change the value of another field, but if you try this you get a zero value, rather than the actual value of the field.

Below is what I used to test the manual input method, I have a node type called "History Event", which has three fields. Partial Date is a Partial Date Field, Normal Date is a Date field (because I wanted to demonstrate that this wasn't a problem with Date or Date API), and Random Text Field is a text field.

Like glrlpl I'm not much of a coder. So I have no idea where to look to find the problem, or even if it might be partly an issue with Rules, but I thought I'd at least test to give a more thorough description of the problem.

{ "rules_partial_date_test" : {
"LABEL" : "Partial Date Test",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Partial Date" ],
"REQUIRES" : [ "rules" ],
"ON" : { "node_presave--history_event" : { "bundle" : "history_event" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_partial_date" } }
],
"DO" : [
{ "data_set" : {
"data" : [ "node:field-random-text-field" ],
"value" : "[node:field_normal_date]; [node:field_partial_date]"
}
}
]
}
}