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.
Stuggling to create a simple rule that compares a commerce checkout field (DOB) with the current date (NOW -18 YEARS) and if not met shows a message
Choosing the operator (less than or greater than seems to show different options and whatever happens when I put in different dates the message either doesn't comeup at all or always comes up - what am I doing wrong please
{ "rules_check_age" : {
"LABEL" : "Check age",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_shipping" ],
"ON" : { "commerce_shipping_collect_rates" : [] },
"IF" : [
{ "data_is" : {
"data" : [ "commerce-order:owner:field-date-of-birth" ],
"op" : "\u003C",
"value" : {
"select" : "site:current-date",
"date_offset" : { "value" : 559872000 }
}
}
}
],
"DO" : [
{ "drupal_message" : { "message" : [ "site:name" ], "type" : "error" } }
]
}
}
Comment | File | Size | Author |
---|---|---|---|
Screen Shot 2014-12-10 at 13.55.02.png | 57.38 KB | artatac | |
Screen Shot 2014-12-10 at 13.54.28.png | 80.7 KB | artatac |
Comments
Comment #1
eswiderski CreditAttribution: eswiderski commentedhaving similar issue. did you figure this out?
Comment #2
kaztur CreditAttribution: kaztur commented+1
Comment #3
bobfries CreditAttribution: bobfries commentedSame. Have noticed rules failing at the date check. It either returns FALSE for every item in the loop or TRUE for every item depending on whether the value check is Greater Than or Less Than.
Anyone got a fix for this yet?
Comment #4
TR CreditAttribution: TR commentedAdditional information about @kaztur's situation in #2, as taken from the duplicate issue #2595955: Data comparison: date doesn't work: