Date.strToDate: Only check for date.* localized strings in client

Zotero.getString() now exists in the connector, but the expected strings
aren't defined (or needed), so an error is logged.
This commit is contained in:
Dan Stillman 2018-04-24 05:08:27 -04:00
parent d573a5b639
commit e31d706ee4

View file

@ -296,13 +296,13 @@ Zotero.Date = new function(){
// Parse 'yesterday'/'today'/'tomorrow'
var lc = (string + '').toLowerCase();
if (lc == 'yesterday' || (Zotero.getString && lc === Zotero.getString('date.yesterday'))) {
if (lc == 'yesterday' || (Zotero.isClient && lc === Zotero.getString('date.yesterday'))) {
string = Zotero.Date.dateToSQL(new Date(Date.now() - 1000*60*60*24)).substr(0, 10); // no 'this' for translator sandbox
}
else if (lc == 'today' || (Zotero.getString && lc == Zotero.getString('date.today'))) {
else if (lc == 'today' || (Zotero.isClient && lc == Zotero.getString('date.today'))) {
string = Zotero.Date.dateToSQL(new Date()).substr(0, 10);
}
else if (lc == 'tomorrow' || (Zotero.getString && lc == Zotero.getString('date.tomorrow'))) {
else if (lc == 'tomorrow' || (Zotero.isClient && lc == Zotero.getString('date.tomorrow'))) {
string = Zotero.Date.dateToSQL(new Date(Date.now() + 1000*60*60*24)).substr(0, 10);
}
else {