Remove 'yesterday'/'today'/'tomorrow' parsing from strToDate()

I don't think this ever should've been here. It was added in 2010 but
then added to itembox.xml a couple weeks later in d500b50e2, since
that's where the conversion should happen.

Closes #1749
This commit is contained in:
Dan Stillman 2019-11-12 02:13:05 -05:00
parent 24a3a38c51
commit a549a64de9

View file

@ -263,6 +263,8 @@ Zotero.Date = new function(){
order: ''
};
string = Zotero.Utilities.trimInternal(string.toString());
// skip empty things
if(!string) {
return date;
@ -270,21 +272,6 @@ Zotero.Date = new function(){
var parts = [];
// Parse 'yesterday'/'today'/'tomorrow'
var lc = (string + '').toLowerCase();
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.isClient && lc == Zotero.getString('date.today'))) {
string = Zotero.Date.dateToSQL(new Date()).substr(0, 10);
}
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 {
string = string.toString().replace(/^\s+|\s+$/g, "").replace(/\s+/, " ");
}
// first, directly inspect the string
var m = _slashRe.exec(string);
if(m &&