Date sorting glitch

Bug #889753 reported by Capnm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Charles Haley

Bug Description

The tweak "Control how dates are displayed" is set to the default
("gui_timestamp_display_format = 'dd MMM yyyy'")

The tweak "Choose whether dates are sorted using visible fields" is set to true
("sort_dates_using_visible_fields = True")

Sorting on the Date (timestamp) column appears to sort on yyyyMMddam, instead of the expected yyyyMMdd. That is to say, within a given day all the am timestamps sort as equal, and all the pm timestamps sort as (a different) equal.

(Incidentally, the am/AM documentation did not make it into the tweak help box, nor did the last_modified default if not set)

(And I could swear you mentioned iso as a formatting option somewhere ... should that be documented?)

Thanks!
(0.8.26)

Related branches

Capnm (mgbrown)
description: updated
description: updated
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 889753

Changing the component for this bug.

 assignee cbhaley
 status triaged

Changed in calibre:
assignee: nobody → Charles Haley (cbhaley)
status: New → Triaged
Revision history for this message
Charles Haley (cbhaley) wrote :

Sorry, but I don't understand what the problem is.

Guessing at what it might be, as a test I set the titles and timestamps on 3 books to be
title 1, timestamp 2011-11-08T13:16:26,
title D, timestamp 2011-11-08T11:21:57, and
title T, timestamp 2011-11-08T13:16:27.

After setting the display to dd MMM yyyy, I sort by title ascending, and then by timestamp descending. The three books end up in ascending title order within the timestamp, which means that the time including am/pm is being ignored. If any part of the time was considered significant, the titles would not be in the correct order.

What is it that you are seeing? Can you give examples?

Changed in calibre:
status: Triaged → Incomplete
Revision history for this message
Capnm (mgbrown) wrote :

???!

That's pretty much what I have --
Several books @ each of
2011-11-07T03:xx:xx
2011-11-07T09:xx:xx
2011-11-07T21:xx:xx

As you, I set the display to dd MMM yyyy, I sort by title ascending, and then by timestamp descending.

The T21: books are first, in title order, followed by the T03: and the T09: as one group together in title order.

Sorting by timestamp ascending again gives two groups, the T03/T09 group followed by the T21 group.

I don't know if it is significant, but I haven't touched these timestamps -- they were created under 0.8.23.

am/pm seemed the obvious explanation ?puzzled?

When I have a chance I'll copy some books to a clean library, and if the problem persists, upload the metadata.db if that would help.

Revision history for this message
Capnm (mgbrown) wrote :

Almost forgot ---

I tried setting the display tweak to "dd MMM yyyy-hh"

And it sorted in three groups, each sorted by title, as expected.

Revision history for this message
Charles Haley (cbhaley) wrote :

Found it. The problem has to do with timezone correction. I changed the date/times to UTC, which in some cases can cause the date to move forward or back a day. For example, if you live in US Eastern time (UTC+5h), then times after 19:00 will move forward a day.

My fix is to use localtime instead of UTC. Although the time will still be corrected, it should work because localtime is what is being displayed on the GUI. You will be sorting on the values corrected in the same way as what you are seeing. At least I hope so.

Changed in calibre:
status: Incomplete → Fix Committed
Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in lp:calibre

Fixed in branch lp:calibre. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.