No libraries, no, not even in regular Zotero translators.
Zotero can parse dates quite well and YYYY/MM/DD would work nicely. How
to solve this depends on the database. If it's all post 2000, you can
just .prepend("20") and be done with it. Otherwise, you'd have to use a
hook to do explicitly what the YY format expects the user to do
implicitly, i.e. something like testing for whether it's >20 and in that
case prepend 19, otherwise prepend 20.
On 01/03/2016 05:10 AM, Shel wrote:
>
> Hi,
>
> I’m trying to write a translator for a website with the Translator
> Framework <
https://www.zotero.org/support/dev/translators/framework>,
> but I’m not very familiar with Javascript. The date string I get on
> the website is like|yy/MM/DD|, I need to do something to parse it, or
> reformat it at least. Is it possible to use some utility library, like
> Moment.js, within the framework? What is the elegant way to deal with
> this kind of date format with basic javascript?
>
> |FW.Scraper({ itemType : 'report', detect : FW.Url().match(/detail/),
> title : FW.Xpath('//XPATH').text().trim(), // the date string got here
> is formatted 'YY/MM/DD': date :
> FW.Xpath('//XPATH').text().match(/[\d\/]+/), }); |
>
> Thanks
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "zotero-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
zotero-dev+...@googlegroups.com
> <mailto:
zotero-dev+...@googlegroups.com>.
> To post to this group, send email to
zoter...@googlegroups.com
> <mailto:
zoter...@googlegroups.com>.
> Visit this group at
https://groups.google.com/group/zotero-dev.
> For more options, visit
https://groups.google.com/d/optout.