-
Notifications
You must be signed in to change notification settings - Fork 6
Vsliv30 3515 creation time filter misbehaviour #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vsliv30 3515 creation time filter misbehaviour #57
Conversation
$builder->orWhere(function ($query) use ($column, $formattedDateTime) { | ||
$query->where($column, '=', $formattedDateTime); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for nesting.......
this is enough: $builder->orWhere($column, $formattedDateTime);
$builder->orWhere(function ($query) use ($column, $formattedDateTime) { | ||
$query->whereDate($column, '=', date('Y-m-d', strtotime($formattedDateTime))) | ||
->whereTime($column, '>=', date('H:i', strtotime($formattedDateTime))) | ||
->whereTime($column, '<', date('H:i', strtotime($formattedDateTime . ' +1 minute'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and what if we strictly want to search by second = 0? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, someone could search for '000' or '0000' as well :)) so let's change it to
if (preg_match('/^0+$/', $dateTimeValue->format('s'))) {...}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, because it doesn't change things.
Seconds will always be 00 in this case, number of 0 was not the point... :)
The point is that FE only selects up to minutes (and adds 00 as seconds) - so this scenario works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the number of zeros wasn't the point, why mention it ;) Since it was mentioned, I went one step further and satisfied those who would go crazy entering endless zeros ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not mention number of zeroes, but the fact that you can not find a record that strictly has 0 second. :)
for example: 2024-07-11 11:28:00
;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we both understood each other in the first run and that's all that matters ;)
No description provided.