• knireis

    (@knireis)


    Hi,
    How can i filter in the backend on a date field?
    I have format like 3 november 2020, but when filtering on datefield contains november there are no returns.
    Regards, Jasper

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author xnau webdesign

    (@xnau)

    You cannot do a “contains” search on a date field, you need to do a ranged search to get all of the records that fall within a range of dates, for example:

    Thread Starter knireis

    (@knireis)

    Ah i see i have to type the dates manual, with the datepicker i get only 1 date.
    But i also would like to filter on birthday month, so everyone who’s birthday is in November, the year should be excluded. Is that possible?

    Plugin Author xnau webdesign

    (@xnau)

    If you want to use the datepicker, you need to add another filter line, and then do a “greater than” and “less than” search on each line.

    It is not currently possible to do a search for all dates that are in a month in any year, dates are stored as numeric timestamps, not date strings, so you can’t do a string search on a date field.

    Plugin Author xnau webdesign

    (@xnau)

    There is a workaround for this, you can use a string combine field to hold the date as a string. Just set up the string combine field template to include the date field. This will store the date as a string, which can then be searched by month.

    Thread Starter knireis

    (@knireis)

    can you be a bit more detailed please?
    Do i need to setup a new field and define it as stringcombine field?

    Plugin Author xnau webdesign

    (@xnau)

    Yes, the idea is you set up a new “String Combine” field that has only the date field in the template (read the link I provided for how to do that).

    This field is in addition to the date field, so you will have two fields that represent the date, but in a different way that allows for text searches (such as “November”) on the date.

    Thread Starter knireis

    (@knireis)

    Got it, thanks

    Thread Starter knireis

    (@knireis)

    Maybe last question.
    I managed to filter all members born in june.
    Now is it possible to sort them only based on the date, not the year?

    Plugin Author xnau webdesign

    (@xnau)

    The field that is the date string will be sorted alphabetically, the field that has the date timestamp can be sorted numerically, according to the full date, which includes the year.

    For example, if your date string field (the string combine field) has dates like “November 15, 1993” then the alphabetical sort will sort by month, then the day, then the year. How that works depends on the format you are using, but it will always be an alphabetical sort of the string.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘filter backend on date’ is closed to new replies.