Search

Howdy, I have a data source that is filtered by date and by title.

I'm using URL Params to filter it with the following structure: {root}/articles/{year}/{month}/{title}

This filtering performs perfectly all the time. I can even enter dates in the future it pulls them up.

It works perfectly for every day other than today - 30 April 2011. Any articles entered with that date are not found. I just get a 'no results' error in the XML.

These articles do however show up in my main feed (separate data source) and have the date listed correctly (this is filtered on the date using earlier than today.

If I keep everything the same and just change the date of the article to a day after (April 29) or a day later (May 1) I can use the articles page to find the article and it works fine. This is especially weird because I'm not using the dayto filter anything - only the month.

It just doesn't like 30th April!

Anyone got any ideas as to why? So very strange!

Try earlier than {$today}, {$today}

Hey - thanks for the reply I think i've confused matters above: the data source that is having problems isn't filtered by earlier than today - that is the main feed which is working perfectly. I included it to show that the same entries were appearing correctly elsewhere.

The page/data source that has the issues is filtered on the date field by {year}-{month} and on the title field by {title}.

My page has the following in for the url parameters: year/month/title

UPDATE: Just did some more experimenting and it looks like the issue is the same for the last day of every month!!

Whenever an article has a date that is the last of the month (May 31, June 30 etc) it fails to be found by the filter 2011/05 or 2011/06

It's like it stops thinking the article is in that month?

Can you try this replacing Line 329 of field.date.php with

$string = "{$start} to {$string}-" . DateTimeObj::get('t', $start) . " 23:59:59";

Hey Brendo,

Line 329 looks like an odd one to replace (based on my very limited php knowledge).

Line 329 only has a } to close this block:

switch($match[2]){
                case 'later': $string = $later . ' to 2038-01-01'; break;
                case 'earlier': $string = '1970-01-01 to ' . $earlier; break;
*line 329*          }

So replacing that line would leave that block unclosed. My php knowledge is very sketchy so not really sure where to put it? Probably obvious to others but sadly not to me sorry!

T

Thanks!

I'm guessing your code is meant to replace one of those cases? Sorry - my php is terrible!

What version of symphony are you running?

This is an additional question as I'm experiencing some issues with the date field as well: Is it possible that in the latest version of Symphony the date field doesn't take the time into account. Filtering by earlier than now will not return today's entries and start with the entries posted before today (and not now).

@ Brendo - I'm stil on 2.2. The file i'm looking at (field.date.php) is in symphony/lib/toolkit/fields - hopefully I'm in the right place...

@ Nils - In 2.2 I'm using earlier than now on the date field to filter the main stream of a blog (so entries can be scheduled for future times) and it's working perfectly. Entries that are created before the current day & time show up - including on the day they are created. I've tested it with scheduling posts for 1 hour in advance and they show up at the correct time. Not sure about 2.2.1 though as haven't upgraded this install yet.

This line in a 2.2 install.

I'd recommend 2.2.1 as there are some date improvements/changes/fixes in this version that may solve your problem (as well as other changes)

If not, can you try the fix I previously posted on the 2.2.1 install (it might be helpful you too nils)

Hey Brendo,

Thanks for this - have now updated to 2.2.1 (needed to anyway). That didn't fix the issue, but by changing the line you suggested above those entries are now being found by the filter!

Brilliant - thanks again.

Hi again, Having updated to 2.2.1 I'm now getting the bug that Nils mentioned above... a filter for

earlier than now

on the date field is not getting entries created in the last 24 hours. Anyone got a fix for this?

@ Nils did you have any luck fixing it?

Only entries that are posted exactly 24 hours before 'Now' are showing up.

Thanks Nils - I'll just try altering those lines of code you suggested I think. That or add earlier than or equal to now to all of my data sources. Will see which works best.

Cheers!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details