jDownloadsownloads.com


Author Topic: Datetime rather than Date  (Read 246 times)

0 Members and 1 Guest are viewing this topic.

Offline ColinM

  • Moderator
  • *
  • Posts: 4.040
Datetime rather than Date
« on: 22.08.2019 13:41:35 »
Originally posted by EURRWebmaster in http://www.jdownloads.com/forum/index.php?topic=11682.msg43782#msg43782

The code components/com_jdownloads/models/downloads.php 470 and 473 (jD 32..65) currently checks datetime instead of only the date I guess this is a bug.Original
Code: [Select]
$startDateRange = $db->Quote($this->getState('filter.start_date_range', $nullDate));
$endDateRange = $db->Quote($this->getState('filter.end_date_range', $nullDate));
$query->where('('.$dateField.' >= '.$startDateRange.' AND '.$dateField .
                    ' <= '.$endDateRange.')');
Here is an fix which is in the $query:
Code: [Select]
$startDateRange = $db->Quote($this->getState('filter.start_date_range', $nullDate));
$endDateRange = $db->Quote($this->getState('filter.end_date_range', $nullDate));     
$query->where(date('.$dateField.') >= '.$startDateRange.' AND date('.$dateField .
') <= '.$endDateRange.');

 Colin 

Offline EURRWebmaater

  • Newbie
  • *
  • Posts: 15
Re: Datetime rather than Date
« Reply #1 on: 25.08.2019 15:27:35 »
For safety also convert the parameters to date:
Code: [Select]
$query->where(date('.$dateField.') >= date('.$startDateRange.') AND date('.$dateField .
') <= date('.$endDateRange.'));

Offline EURRWebmaater

  • Newbie
  • *
  • Posts: 15
Re: Datetime rather than Date
« Reply #2 on: 25.08.2019 15:46:42 »
Corection (at the end)
Code: [Select]
$query->where('date('.$dateField.') >= date('.$startDateRange.') AND date('.$dateField .
') <= date('.$endDateRange . '))';