| @@ -72,9 +72,15 @@ | ||
| 72 | 72 | */ |
| 73 | 73 | public function findByTripIdAndDate(int $tripId, string $departureDate): ?object |
| 74 | 74 | { |
| 75 | 75 | $table = esc_sql($this->table); |
| 76 | - | |
| 76 | + | |
| 77 | + // departure_date is a DATE column — strip any time component so a datetime | |
| 78 | + // input still matches (avoids date-vs-datetime string-compare misses). | |
| 79 | + if (preg_match('/^(\d{4}-\d{2}-\d{2})/', $departureDate, $m)) { | |
| 80 | + $departureDate = $m[1]; | |
| 81 | + } | |
| 82 | + | |
| 77 | 83 | $result = $this->wpdb->get_row($this->wpdb->prepare( |
| 78 | 84 | "SELECT * FROM `{$table}` |
| 79 | 85 | WHERE trip_id = %d |
| 80 | 86 | AND departure_date = %s |