Last active
September 24, 2022 00:40
Zotero Better Bibtex - Postscript to format access date (long format) and url fields on webpage items and setting month field as a number on any item.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Translator.BetterBibTeX) { | |
if (tex.has.month) { | |
tex.add({ name: 'month', value: tex.date.month}); | |
} | |
if (zotero.itemType === 'webpage') { | |
if (zotero.accessDate) { | |
var customDate = new Date(zotero.accessDate.replace(/\s*T?\d+:\d+:\d+.*/, '')); | |
var intlCustomDate = new Intl.DateTimeFormat('en-GB', {year: 'numeric', month: 'long', day: 'numeric'}).format(customDate); | |
tex.add({ name: 'note', value: "(accessed on " + intlCustomDate + ")" }); | |
} | |
if (zotero.url) { | |
tex.add({ name: 'howpublished', bibtex: "{Available online: \\url{" + tex.enc_verbatim({value: zotero.url}) + "}}" }); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment