[Validator] Convert objects to string in comparison validators

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

In the latest merge from 2.3 into 2.4, the changes from 6cf5e0812e6f20d60acbc0324abf96475e89b6ef in 2.4 got lost. This PR brings back these changes and backports them to 2.3.

The change is BC, because the former value `true` of the `$prettyDateTime` will be cast to `1`, which corresponds to the `PRETTY_DATE` format constant.