How to do a date range entityQuery with a Date only field in Drupal 8?
I'm doing lots of conditions like that in entity queries, I haven't encountered a problem yet.

The main thing you have to be aware of is the timezone the data is stored, which is UTC. You need to convert it to the storage timezone (there's a constant for that), or your query will be off by a few hours.

Here's an example based on something I'm doing, if you only store days, then there is a constant for formatting that too.

$date = new DrupalDateTime('21 days ago');
$date-&gt;setTimezone(new \DateTimezone(DATETIME_STORAGE_TIMEZONE));
$formatted = $date-&gt;format(DATETIME_DATETIME_STORAGE_FORMAT);

$nids = \Drupal::entityQuery('node')
  -&gt;condition('your_date_field.value', $formatted, '&lt;=')
  -&gt;range(0, 50)
  -&gt;execute();