Fixed before/after + date_format rules inconsistencies

This PR fixes the PR #3607 implementation to provide the missing PR #1824 functionality and line up `before`/`after` rules to work smoothly with and without a `date_format` rule.