GabLeRoux / webextensions-history-browser

🕘 Browse your firefox history like a boss.
https://addons.mozilla.org/en-US/firefox/addon/webextensions-history-browser/
MIT License
20 stars 1 forks source link

Entries don't appear in time order #10

Closed carlf66 closed 5 years ago

carlf66 commented 5 years ago

I now have 5000 entries starting on 5/1 and ending 5/23. However, the listing start with the entries for 5/9. To get to the latest entries, I have to go to page 14. That is very awkward. Can you fix it so that page 1 shows the latest entries, please? Thanks, Carl

GabLeRoux commented 5 years ago

Oh that's definitely a problem, I'll have a look at the code to find out why this happens. Thanks for the issue 👍 Sounds related to #4

GabLeRoux commented 5 years ago

So issue is with datatable and it's formating. When ordering the column, it uses lexical sorting instead of date sorting. Here, we can reproduce the problem with the last column:
https://editor.datatables.net/examples/dates/formatting.html

So I switched the format to empty string (which defaults to ISO8601 in moment.js and this solves the ordering problem.

I will confirm that #12 still works on firefox and I will publish a new version shortly.

jrobichaud commented 5 years ago

ISO-8601 is correctly lexicographically orderable only when the time offset is constant when comparing dates.

However the two hour period when the timezone of the user changes from daylight saving time to standard time the sort will be all mixed up.

Example: 2019-11-03T00:01:00-04:00’ and ‘2019-11-03T00:00:00-05:00’ are 59 minutes apart but the lexicographical order is incorrect.

It is not a big deal because it represents only 0.02% of the whole year and the user has to be browsing during that period.

I just wanted to let you know.

GabLeRoux commented 5 years ago

I created #21 and #22 to allow user to specify a different format and have datatables still sort correctly using the date instead of its text representation :+1: