Use ISO 8601 accessDates everywhere
This uses ISO 8601 dates for generateAllTypesAndFieldsData (and changes populateDBWithSampleData to use Item#fromJSON), and makes translators expect ISO 8601 accessDates, although SQL accessDates are still supported with a deprecation warning. Canonicalization happens in Zotero.Translate, so I need to remember to update connectors as well.
This commit is contained in:
parent
8448203583
commit
70f021f945
|
@ -174,6 +174,18 @@ Zotero.Translate.Sandbox = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.version) {
|
||||||
|
translate._debug("Translate: item.version is deprecated; set item.versionNumber instead");
|
||||||
|
item.versionNumber = item.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.accessDate) {
|
||||||
|
if (Zotero.Date.isSQLDateTime(item.accessDate)) {
|
||||||
|
translate._debug("Translate: Passing accessDate as SQL is deprecated; pass an ISO 8601 date instead");
|
||||||
|
item.accessDate = Zotero.Date.sqlToISO8601(item.accessDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fire itemSaving event
|
// Fire itemSaving event
|
||||||
translate._runHandler("itemSaving", item);
|
translate._runHandler("itemSaving", item);
|
||||||
|
@ -581,13 +593,13 @@ Zotero.Translate.Sandbox = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// automatically set library catalog
|
// automatically set library catalog
|
||||||
if(item.libraryCatalog === undefined) {
|
if(item.libraryCatalog === undefined && item.itemType != "webpage") {
|
||||||
item.libraryCatalog = translate.translator[0].label;
|
item.libraryCatalog = translate.translator[0].label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// automatically set access date if URL is set
|
// automatically set access date if URL is set
|
||||||
if(item.url && typeof item.accessDate == 'undefined') {
|
if(item.url && typeof item.accessDate == 'undefined') {
|
||||||
item.accessDate = "CURRENT_TIMESTAMP";
|
item.accessDate = Zotero.Date.dateToISO(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
//consider type-specific "title" alternatives
|
//consider type-specific "title" alternatives
|
||||||
|
|
|
@ -107,7 +107,6 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
seeAlso:item.seeAlso,
|
seeAlso:item.seeAlso,
|
||||||
id:item.itemID || item.id
|
id:item.itemID || item.id
|
||||||
};
|
};
|
||||||
if (item.version) item.versionNumber = item.version;
|
|
||||||
newItem.fromJSON(this._deleteIrrelevantFields(item));
|
newItem.fromJSON(this._deleteIrrelevantFields(item));
|
||||||
|
|
||||||
// save item
|
// save item
|
||||||
|
|
|
@ -411,7 +411,7 @@ function generateAllTypesAndFieldsData() {
|
||||||
let specialValues = {
|
let specialValues = {
|
||||||
date: '1999-12-31',
|
date: '1999-12-31',
|
||||||
filingDate: '2000-01-02',
|
filingDate: '2000-01-02',
|
||||||
accessDate: '1997-06-13 23:59:58',
|
accessDate: '1997-06-13T23:59:58',
|
||||||
number: 3,
|
number: 3,
|
||||||
numPages: 4,
|
numPages: 4,
|
||||||
issue: 5,
|
issue: 5,
|
||||||
|
@ -482,29 +482,8 @@ function populateDBWithSampleData(data) {
|
||||||
return Zotero.DB.executeTransaction(function* () {
|
return Zotero.DB.executeTransaction(function* () {
|
||||||
for (let itemName in data) {
|
for (let itemName in data) {
|
||||||
let item = data[itemName];
|
let item = data[itemName];
|
||||||
let zItem = new Zotero.Item(item.itemType);
|
let zItem = new Zotero.Item;
|
||||||
for (let itemField in item) {
|
zItem.fromJSON(item);
|
||||||
if (itemField == 'itemType') continue;
|
|
||||||
|
|
||||||
if (itemField == 'creators') {
|
|
||||||
zItem.setCreators(item[itemField]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemField == 'tags') {
|
|
||||||
// Must save item first
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
zItem.setField(itemField, item[itemField]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.tags && item.tags.length) {
|
|
||||||
for (let i=0; i<item.tags.length; i++) {
|
|
||||||
zItem.addTag(item.tags[i].tag, item.tags[i].type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item.id = yield zItem.save();
|
item.id = yield zItem.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"artwork": {
|
"artwork": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"artworkSize": "Artwork size",
|
"artworkSize": "Artwork size",
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
"audioRecording": {
|
"audioRecording": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
},
|
},
|
||||||
"bill": {
|
"bill": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"code": "Code",
|
"code": "Code",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
},
|
},
|
||||||
"blogPost": {
|
"blogPost": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "author",
|
"creatorType": "author",
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
"book": {
|
"book": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
"bookSection": {
|
"bookSection": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
},
|
},
|
||||||
"case": {
|
"case": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"court": "Court",
|
"court": "Court",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
"computerProgram": {
|
"computerProgram": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -326,7 +326,7 @@
|
||||||
"DOI": "10.1234/example.doi",
|
"DOI": "10.1234/example.doi",
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -377,7 +377,7 @@
|
||||||
"dictionaryEntry": {
|
"dictionaryEntry": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -429,7 +429,7 @@
|
||||||
},
|
},
|
||||||
"document": {
|
"document": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -473,7 +473,7 @@
|
||||||
},
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "author",
|
"creatorType": "author",
|
||||||
|
@ -503,7 +503,7 @@
|
||||||
"encyclopediaArticle": {
|
"encyclopediaArticle": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -555,7 +555,7 @@
|
||||||
},
|
},
|
||||||
"film": {
|
"film": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -597,7 +597,7 @@
|
||||||
},
|
},
|
||||||
"forumPost": {
|
"forumPost": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "author",
|
"creatorType": "author",
|
||||||
|
@ -623,7 +623,7 @@
|
||||||
},
|
},
|
||||||
"hearing": {
|
"hearing": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"committee": "Committee",
|
"committee": "Committee",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
|
@ -651,7 +651,7 @@
|
||||||
},
|
},
|
||||||
"instantMessage": {
|
"instantMessage": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "author",
|
"creatorType": "author",
|
||||||
|
@ -680,7 +680,7 @@
|
||||||
},
|
},
|
||||||
"interview": {
|
"interview": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -721,7 +721,7 @@
|
||||||
"DOI": "10.1234/example.doi",
|
"DOI": "10.1234/example.doi",
|
||||||
"ISSN": "1234-5679",
|
"ISSN": "1234-5679",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -772,7 +772,7 @@
|
||||||
},
|
},
|
||||||
"letter": {
|
"letter": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -807,7 +807,7 @@
|
||||||
"magazineArticle": {
|
"magazineArticle": {
|
||||||
"ISSN": "1234-5679",
|
"ISSN": "1234-5679",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -849,7 +849,7 @@
|
||||||
},
|
},
|
||||||
"manuscript": {
|
"manuscript": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -886,7 +886,7 @@
|
||||||
"map": {
|
"map": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -926,7 +926,7 @@
|
||||||
"newspaperArticle": {
|
"newspaperArticle": {
|
||||||
"ISSN": "1234-5679",
|
"ISSN": "1234-5679",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -969,7 +969,7 @@
|
||||||
},
|
},
|
||||||
"patent": {
|
"patent": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"applicationNumber": "Application number",
|
"applicationNumber": "Application number",
|
||||||
"assignee": "Assignee",
|
"assignee": "Assignee",
|
||||||
"country": "Country",
|
"country": "Country",
|
||||||
|
@ -1009,7 +1009,7 @@
|
||||||
},
|
},
|
||||||
"podcast": {
|
"podcast": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "podcaster",
|
"creatorType": "podcaster",
|
||||||
|
@ -1041,7 +1041,7 @@
|
||||||
},
|
},
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "presenter",
|
"creatorType": "presenter",
|
||||||
|
@ -1068,7 +1068,7 @@
|
||||||
},
|
},
|
||||||
"radioBroadcast": {
|
"radioBroadcast": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -1122,7 +1122,7 @@
|
||||||
},
|
},
|
||||||
"report": {
|
"report": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -1166,7 +1166,7 @@
|
||||||
},
|
},
|
||||||
"statute": {
|
"statute": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"code": "Code",
|
"code": "Code",
|
||||||
"codeNumber": "Code number",
|
"codeNumber": "Code number",
|
||||||
"creators": [
|
"creators": [
|
||||||
|
@ -1197,7 +1197,7 @@
|
||||||
},
|
},
|
||||||
"thesis": {
|
"thesis": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -1229,7 +1229,7 @@
|
||||||
},
|
},
|
||||||
"tvBroadcast": {
|
"tvBroadcast": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -1284,7 +1284,7 @@
|
||||||
"videoRecording": {
|
"videoRecording": {
|
||||||
"ISBN": "978-1-234-56789-7",
|
"ISBN": "978-1-234-56789-7",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
@ -1334,7 +1334,7 @@
|
||||||
},
|
},
|
||||||
"webpage": {
|
"webpage": {
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58",
|
||||||
"creators": [
|
"creators": [
|
||||||
{
|
{
|
||||||
"creatorType": "author",
|
"creatorType": "author",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"DOI": "10.1234/example.doi",
|
"DOI": "10.1234/example.doi",
|
||||||
"ISSN": "1234-5679",
|
"ISSN": "1234-5679",
|
||||||
"abstractNote": "Abstract note",
|
"abstractNote": "Abstract note",
|
||||||
"accessDate": "1997-06-13 23:59:58",
|
"accessDate": "1997-06-13T23:59:58Z",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"archiveLocation": "Archive location",
|
"archiveLocation": "Archive location",
|
||||||
"callNumber": "Call number",
|
"callNumber": "Call number",
|
||||||
|
|
|
@ -41,7 +41,9 @@ describe("Support Functions for Unit Testing", function() {
|
||||||
if (skipFields.indexOf(prop) != -1) continue;
|
if (skipFields.indexOf(prop) != -1) continue;
|
||||||
|
|
||||||
// Using base-mapped fields
|
// Using base-mapped fields
|
||||||
assert.equal(item[prop], zItem.getField(prop, false, true), 'inserted item property has the same value as sample data');
|
let field = zItem.getField(prop, false, true);
|
||||||
|
if (prop === "accessDate") field = Zotero.Date.sqlToISO8601(field);
|
||||||
|
assert.equal(field, item[prop], 'inserted item property has the same value as sample data');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.creators) {
|
if (item.creators) {
|
||||||
|
|
|
@ -183,6 +183,16 @@ describe("Zotero.Translate", function() {
|
||||||
assert.deepEqual(savedItems, trueItems, "saved items match inputs");
|
assert.deepEqual(savedItems, trueItems, "saved items match inputs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should accept deprecated SQL accessDates', function* () {
|
||||||
|
let myItem = {
|
||||||
|
"itemType":"webpage",
|
||||||
|
"title":"Test Item",
|
||||||
|
"accessDate":"2015-01-02 03:04:05"
|
||||||
|
}
|
||||||
|
let newItems = yield saveItemsThroughTranslator("import", [myItem]);
|
||||||
|
assert.equal(newItems[0].getField("accessDate"), "2015-01-02 03:04:05");
|
||||||
|
});
|
||||||
|
|
||||||
it('should save tags', function* () {
|
it('should save tags', function* () {
|
||||||
let myItem = {
|
let myItem = {
|
||||||
"itemType":"book",
|
"itemType":"book",
|
||||||
|
@ -392,6 +402,19 @@ describe("Zotero.Translate", function() {
|
||||||
assert.equal(newItems[0].getAttachments().length, 0);
|
assert.equal(newItems[0].getAttachments().length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('web translators should set accessDate to current date', function* () {
|
||||||
|
let myItem = {
|
||||||
|
"itemType":"webpage",
|
||||||
|
"title":"Test Item",
|
||||||
|
"url":"http://www.zotero.org/"
|
||||||
|
};
|
||||||
|
let newItems = yield saveItemsThroughTranslator("web", [myItem]);
|
||||||
|
let currentDate = new Date();
|
||||||
|
let delta = currentDate - Zotero.Date.sqlToDate(newItems[0].getField("accessDate"), true);
|
||||||
|
assert.isAbove(delta, -500);
|
||||||
|
assert.isBelow(delta, 5000);
|
||||||
|
});
|
||||||
|
|
||||||
it('web translators should save attachments', function* () {
|
it('web translators should save attachments', function* () {
|
||||||
let myItems = [
|
let myItems = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user