commit d500b50e2e86c707a3c704505cffb644ceac17b2
parent c2fea7e4daddc182d661d931135d79531f49b479
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 25 Jan 2010 18:39:23 +0000
Don't store literal 'today' in Date field
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
@@ -1810,6 +1810,23 @@
}
}
break;
+
+ default:
+ // TODO: generalize to all date rows/fields
+ if (Zotero.ItemFields.isFieldOfBase(fieldName, 'date')) {
+ // Parse 'yesterday'/'today'/'tomorrow' and convert to dates,
+ // since it doesn't make sense for those to be actual metadata values
+ var lc = value.toLowerCase();
+ if (lc == 'yesterday' || lc == Zotero.getString('date.yesterday')) {
+ value = Zotero.Date.dateToSQL(new Date(new Date().getTime() - 86400000)).substr(0, 10);
+ }
+ else if (lc == 'today' || lc == Zotero.getString('date.today')) {
+ value = Zotero.Date.dateToSQL(new Date()).substr(0, 10);
+ }
+ else if (lc == 'tomorrow' || lc == Zotero.getString('date.tomorrow')) {
+ value = Zotero.Date.dateToSQL(new Date(new Date().getTime() + 86400000)).substr(0, 10);
+ }
+ }
}
}