Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter nquaist

    (@nquaist)

    Hi,

    I went to the code and db, apparently the Time field is a text field so, when ascending, it start from 0 to 9. So, if hour is 8 am it will be after 10 am.
    Do you plan to have this changed, my idea is to create a new time field (time format named ntime) and copy all the data from time to ntime then change the filter
    public function get_events($date_filter=null, $cat_filter=null, $num_events=0, $sort_array=array(‘start_date ASC’, ‘time ASC’, ‘end_date ASC’))

    to

    public function get_events($date_filter=null, $cat_filter=null, $num_events=0, $sort_array=array(‘start_date ASC’, ‘ntime ASC’, ‘end_date ASC’))
    Do you have any other idea?

    Thanks

    This is an excellent question. I had the same one. Here’s a work-around I discovered that will correctly sort different timed events on the same day:

    Put the AM or PM first. Then, if the hour has only one digit, put a zero in front of it. For instance:

    AM 06:00
    AM 10:00
    PM 02:00
    PM 07:30

    Because “A” comes before “P” in the alphabet, the AM events will always be sorted first, and the PM events will be sorted second. Moreover, adding a “0” in front of single digit hours ensures that 10:00 will not be sorted before 8:00.

    It looks kind of ugly, but at least it’s functional.

    I would just add that, in my above-stated workaround, the PM 12:00 would get sorted incorrectly, so I’ve been using “NOON 12:00” to get it to sort between the AM and PM entries.

    Plugin Author mibuthu

    (@mibuthu)

    I will have a look at it and I will try to fix this in the next version.

    I was looking for a way to get multiple events on a given day to appear in time order. This works and we will use for now. Other than that your plugin was just what we were looking for.

    Great plugin, but this seems like a serious oversight. Using this for a wedding website for a “schedule of events” and they all take place over the span of 2-3 days. If we can’t sort them by time, we can’t use this. Has the issue been addressed in some capacity yet?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Time Sort’ is closed to new replies.