4 years ago
1
Topic

Hi

Very often we have to make lists that search contents upon date fields. 

The problem is that we often need to retrieve contents whose date field is DURING a time intervall.

EXAMPE : "let's retrieve the news from the month of april in the year 2020"

Granted we use the ART_CREATED native joomla field (for instance) we face the issue of providing a simple interface where the user selects the MONTH and the YEAR  to retrieve the news of this period.

One solution is to create an alias for ART_CREATED and put the two fields (art_created and its alias) in the search form with a >= and <= matching criteria

It works but it is not what we wand (select the month and the year).

Another solution is to create two SIMPLE SELECT fields (MONTHS and YEARS) and use a BEFORE SEARCH CODE field that takes the input values of these two dropdown lists, compute the corresponding 1st day and last day of the month dates and injects those dates in the art_created and its alias fields.

It works, this is what we want but can't we have a simpler solution ? Did someone wrote a date field plugin that allows to only select the month and year ?

thanks

cyril

Get a VIP membership
215 Posts
iliil
4 years ago
0
Level 1

Hi Cyril, I think the second option is ideal. 

In general, I don't think it is a good approach to build and install a Joomla plugin for every little functionality you need.

For me, SEBLOD processing fields like beforeSearch are exactly for these kind of things.

Best

Get a Book for SEBLOD