Closed sgjackman closed 6 years ago
Awesome. Thanks for the issue.
Are you using MySQL? Also, does it work for > & < operators?
---- On Wed, 27 Sep 2017 11:33:47 +1000 notifications@github.com wrote ----
Dates were not being cast as dates, so if you have a query that was filtering between two dates it won't work.
Simple fix would be to turn any field of date into a Carbon object. I did this by editing the getValueForQueryFromRule method like this (just before returning the value)
if ( $rule->type == 'datetime' ) {
if ( is_array( $value ) ) {
$value = array_map( function ( $v ) {
return new Carbon( $v );
}, $value );
} else {
$value = new Carbon( $value );
}
}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Yes using MySQL, and yes it works for the less than and greater than operators! I'm testing the other operators and it looks like "not between" is failing. I think the sanity fix needs to be done elsewhere - I'll get back to you shortly.
Actually - it looks as though "NOT BETWEEN" has not been implemented, so the rule is just ignored. I'll I'll implement a fix and make a pull request when I have some time tomorrow.
Hey I've made the updates in a local branch, but I'm a relative GIT newbie and have no idea how to make a pull request. Can you assist? I've fixed the date casting issue, and added the 'not between' operator. Thanks.
All good - I worked it out. Pull request is there.
Dates were not being cast as dates, so if you have a query that was filtering between two dates it won't work.
Simple fix would be to turn any field of date into a Carbon object. I did this by editing the getValueForQueryFromRule method like this (just before returning the value)