2 users online. Create an account or sign in to join them.Users
A bug in 2.2.1, submitted by Nils on 02 May 2011
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
When trying to filter a data source by a date field with earlier than now, Symphony will not find entries on the same day. It seems like the system is not taking the time into account and uses days instead:
earlier than now
// Date is earlier/later than
$later = DateTimeObj::get('Y-m-d H:i:s', $string . ' + 1 day');
$earlier = DateTimeObj::get('Y-m-d H:i:s', $string . ' - 1 day');
I think replacing day with minute should fix the issue.
Edit: Yes, that fixes it.
I changed that portion on line 298 of field.date.php.
It seemed to work for me, but earlier than has a problem when the time is 12:01 am. It returns the current entry. I changed it to 12:00 am and it worked as expected, returning the next earlier entry. 12:02 am also worked fine. Strange ...
Maybe this is more complex as I thought. The latest version of the Date and Time field approaches this issue differently by taking advantage of PHP's DateTime class:
Maybe we could join the two concepts?
equal to or earlier than now should work.
equal to or earlier than now
I think the general concept is that earlier/later than excludes the current day. If you want the current day, you add equal to or. This was added a long time ago, August 2009
equal to or
If it the concept of earlier/later than to exclude the current day, how would I filter for entries published on the the same day but earlier than the given date? It's not possible as equal to or will always include the given date.
I think Symphony should only exclude the current day if now time has been given in the filter. This is how Date and Time solves this issue.
I know this might seem a little odd, but I'm putting this on the backburner until after Symphony 2.2.2 Beta 1 has been released. I believe Issue #625 could be affecting this bug (and the similar #627) so in an effort to reduce the amount of testing and back and forth trying to recreate scenarios, I'd prefer to wait so we can all start on the same page with Beta 1.
This will be solved for the 2.2.2 Final though, don't worry about that!
Check the integration branch now, there's a number of fixes and changes to the Date field (and filtering) that should resolve this bug.
To get entries from today onwards, you would use equal to or later than today. Using later than without the equal to or omits the current day, so later than today would return all entries from tomorrow and onwards.
equal to or later than today
later than today
This issue is closed.
Contact the team
Symphony • Open Source XSLT CMS