I have a View with a table display format and all columns are set as being sortable. Although the issue isn't specific to Date fields; I am specifically trying to figure out an issue with Date fields.
I have 2 Date fields, one is primary and the other is secondary. I have tried various ways in adding the login for "if (pri) pri, else sec".
- using no results option for pri date field
- using twig in a custom text field
The results are:
- sorts only on the base field; not the rewritten value
- wsod when selecting to sort on this column
I have tried this both with db search as well as Search API - same results. I seem to be able, with Search API, to create an aggregated "First" field which seems to work; although the date format is not adjustable. I have also seen a patch which allows formatting of the base date fields; but my guess is that this will then give a string sorting of the aggregated field (i.e. Dec comes before June).
My next shot is to use the aggregated date field formatted as SOLR is giving by default and assume that is a valid date sort (I think it is, YYYY-MM-DD) and then do up a field formatter to display the correct date format.