Skip to content

Set ISO date in itemFromCSLJSON() #14

Description

@dstillman

For some reason we're using Zotero.Date.formatDate(), but I believe we use strToISO() in most site translators these days. Any reason not to change this?

var item = new Zotero.Item()
Zotero.Utilities.Item.itemFromCSLJSON(
    item,
    {
        type: 'article',
        "issued": {
        	"date-parts": [[ 2000, 3, 15 ]]
        }
        
    }
)
item
{
    "key": null,
    "version": null,
    "itemType": "preprint",
    "date": "March 15, 2000",
    "creators": [],
    "tags": [],
    "collections": [],
    "relations": {}
}

This resulted in a Chinese month being set ("四月 26, 2010") from ACM based on the browser locale:

https://forums.zotero.org/discussion/97683/bug-locale-issues-concerning-zotero-and-zotero-connector

(There was a separate parsing bug there that's been fixed.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions