From 5b267b4264fc69dfa1924d4c0133714fe8069fc2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 26 Apr 2012 16:28:55 -0400 Subject: [PATCH] Fix sorting of base-mapped fields in reports --- components/zotero-protocol-handler.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js index 366143b50..54f81f5c5 100644 --- a/components/zotero-protocol-handler.js +++ b/components/zotero-protocol-handler.js @@ -417,12 +417,11 @@ function ChromeExtensionHandler() { valA = Zotero.Items.getSortTitle(valA); valB = Zotero.Items.getSortTitle(valB); } - // Use multipart date -- would be better just to get - // the unformatted date value directly, but toArray(), - // which we currently use above, doesn't do that else if (sorts[index].field == 'date') { - valA = Zotero.Date.strToMultipart(a[sorts[index].field]); - valB = Zotero.Date.strToMultipart(b[sorts[index].field]); + var itemA = Zotero.Items.getByLibraryAndKey(a.libraryID, a.key); + var itemB = Zotero.Items.getByLibraryAndKey(b.libraryID, b.key); + valA = itemA.getField('date', true, true); + valB = itemB.getField('date', true, true); } // TEMP: This is an ugly hack to make creator sorting // slightly less broken. To do this right, real creator