F
F
faragly2015-05-21 17:35:10
1C-Bitrix
faragly, 2015-05-21 17:35:10

How to filter by the date property on the new 1C-Bitrix D7 core?

Hello! There is a table where each element has a START OF ACTIVITY and an END OF ACTIVITY, it is necessary to check if there is an intersection of active elements when adding a new element. That is, the table already has an element from 05/21/2015 to 05/25/2015, before creating an element with an activity period of 05/23/2015-05/30/2015, you need to find that there is an intersection.

$data = ['from' => '23.05.2015', 'to' => '30.05.2015'];
$arFilter = [">=ACTIVE_FROM" => $data['from'], "<=ACTIVE_TO" => $data['to']]; // не находит
$arFilter = [">=ACTIVE_FROM" => new \Bitrix\Main\Type\Date($data['from']), "<=ACTIVE_TO" => new \Bitrix\Main\Type\Date($data['to'])]; // не находит

How to filter by date?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pomidoroshev, 2015-05-23
@pomidoroshev

If a table is used in the Highload block, then filtering does not work due to the missing UF_ prefix in the field name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question