After much searching and testing, I've finally made some headway creating rules based around the datefield. Since there's a lot of issues related to using date within Rules, I'd like to submit documentation to help out, but wasn't sure if I should post here first or just dive straight into the Docs page.

The biggest issue that should be addressed in documentation is that it is impossible to get a custom date-time format as set in configuration (ie, I had one called "Year" that only displayed a datefield's year) if trying to interact with the field directly through the data selector: it is only available through direct input mode.

For my specific usecase, I wanted to set an integer field with the year of a full datefield. I originally tried to set this variable as a "date," then convert it to an integer, but was again unable to get the custom date-field format I wanted. I had to use a text variable with direct input mode, which allowed selection of the year formatter ([term:field-origin:value:year]). I could then convert it to an integer, and set the data as such.

Also: setting another field with the value of a datefield's end date is confusing; if no enddate is set, Rules will assume the startdate is the enddate and use that value to set the next field as required by the Rule. The only way I could avoid this issue was by adding a condition comparing the first and second field values, Negating the Equals comparison to ensure that the Rule realized it was looking for a different value.

I'd be glad to craft a documentation page with screenshots to help based on some of my examples, but am unsure where to put them.

Comments

MrsWho created an issue. See original summary.

MrsWho’s picture

Issue tags: +date format
MrsWho’s picture

Issue summary: View changes
TR’s picture

@MrsWho

Sorry you never got a reply. I wasn't a maintainer back then so I didn't see this issue, and it's taken me the past year to look through and address most of the 1700+ issues in the queue that I inherited, as well as respond to all new issues over the past year.

I personally would find it very helpful to have some documentation about this. I'm not concerned over exactly where it goes - look through https://www.drupal.org/documentation/modules/rules and choose a page you think is appropriate, then add your own documentation page as a child. If eventually someone decides there's a better place we can always move it. But having it somewhere in the documentation, even if it's the wrong place, is better than not having it at all!

Is this something you would still be able to work on?

I am monitoring the queue now, so if you have any further questions or you need help with the process please post here and I'll respond.