Feature Proposal: SEARCH should be able to sort according to date strings in forms
Motivation
Often I would rather use a comma-delimited or a bulleted list for lists built using a SEARCH, but I have to use a table if I want the results ordered by a date field in a form.
Description and Documentation
add a way for
order='formfield(somefield)' to sort by date.
TablePlugin can sort according to dates in many formats so we should be able to crib from there.
How do we tell
order to sort by dates depends on either an extra parameter (
order='formfield(somefield) asdate') (perhaps
order='date(somefield)') or adding a time/date formfield to the core, or to add this functionality to the
JSCalendarContrib - thus forcing the development to consider plugable formfield data types, and an API for searching, sorting, rendering and so on.
Examples
Impact
Implementation
--
Contributors: ShawnDowler - 07 Oct 2008
Discussion
agreed - but how do we deal with the US habit of putting the month before the day in numerical dates?
--
SvenDowideit - 08 Oct 2008
That's a good question, but I don't think it needs to be addressed here. I just think the same sorting that's currently available in the
TablePlugin should be exposed in the SEARCH order as well.
If someone wants to tackle the backwards US date format, that's fine, but I would call that out of scope for this feature request
I searched thoroughly for a solution to this, but keep coming up with the same answer over and over again.
UseAFormFieldDateToSortAList is 1 year old and has the exact same workaround: use a table and sort that. I just thought that it might not be too much trouble to implement date handling in the
order of a SEARCH. I would use it all the time.
--
ShawnDowler - 08 Oct 2008
considering that
VarSEARCH already has
order="created" and
order="modified" and order="formfield(somefield)", I agree it should be simple-ish - presumably with a 'random' result if there are no dates in the specified formfield, and so on..
--
SvenDowideit - 08 Oct 2008
I think the reason that
order="created" and
order="modified" work without much fuss is because they are already in seconds since 1970 format, so they sort automatically. A call to something similar to d2n needs to take place on the field if it's a date in order to get the sort to work properly.
Ideally, I'd like to have the
date data type in the form field use seconds since 1970 internally just like the
modified and
created dates do, but that would break a lot of things, I'd imagine.
--
ShawnDowler - 09 Oct 2008