hananils/datetime — pull request #141 by vlad-ghita (2013-07-10 12:15:23+00:00)
Title: Add end date as well to sorting SQL.

Given these dates (this is what the user sees in UI):

Entry #1
start: DD.MM.YYYY - 20:00
end: DD.MM.YYYY - 21:00

Entry #2
start: DD.MM.YYYY - 20:00

In database they're stored like this (end date is automatically set to start date, very good thing):

start: DD.MM.YYYY - 20:00
end: DD.MM.YYYY - 21:00

start: DD.MM.YYYY - 20:00
end: DD.MM.YYYY - 20:00

In this case, a DS with sorting for this field will return entries in this order:

Entry #1
Entry #2

This is not true, because `Entry #2` is earlier than `Entry #1` (NB: same start, but `Entry #2.end` < `Entry #1.end`). With this patch the sorting order takes into account the end date as well thus returning correct order:

Entry #2
Entry #1

Thanks!