diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 15d7b3ecfe..6c1d1a1741 100644 --- 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); + } + } } }