Topic: Filtering posts by date, but only showing dates with posts available?

Hi There,

I've searched but couldn't find much information on this and was wondering if anyone had any ideas.  I'd like to have some kind've form select/dropdown that shows a list of dates where posts were created and to have the user filter out and show those posts from those days as to remove any dates that aren't applicable.

Anyone have any ideas?

Re: Filtering posts by date, but only showing dates with posts available?

This is actually done pretty easily using Ruby's wonderful uniq method. To make an array of all the dates available, but not have any repeats, you'd just go:

dates = Array.new
database_items.each do |r|
dates << r.date
end

dates.uniq!


dates now has all of the dates that have been used once or more. If you need help creating the dropdown or making the find statement, just say so. Good luck!

Re: Filtering posts by date, but only showing dates with posts available?

I could use some help with the dropdown filter box.. also then understanding when picking a date how to display the records from that date.