我有两个“start_date”和“end_date”的自定义字段(高级自定义字段),我想过滤两个给定日期之间的项目,这是我尝试过的:
array(
'key' => 'date_start',
'value' => array($date_start_formatted, $date_end_formatted),
'type' => 'DATE',
'compare' => 'BETWEEN',
),
并且:
array(
'key' => 'date_start',
'type' => 'DATE',
'value' => $date_start_formatted,
'compare' => '>=',
),
array(
'key' => 'date_end',
'type' => 'DATE',
'value' => $date_end_formatted,
'compare' => '<=',
),
有没有办法找到适合这两个日期之间的所有项目日期,例如,
date_start filter = 05.05.2020 and date_end filter = 20.05.2020
but project is date_start = 04.05.2020 and date_end is = 19.05.2020
additionally project 2 has date_start of 07.05.2020 but end date is = 22.05.2020
(basically finds all projects that have some dates between the two filtered)
出现了两个项目,因为它们的某些日期在给定的过滤器之间