Don't store literal 'today' in Date field
This commit is contained in:
parent
c2fea7e4da
commit
d500b50e2e
1 changed files with 17 additions and 0 deletions
|
@ -1810,6 +1810,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue