jlegewie / zotfile

Zotero plugin to manage your attachments: automatically rename, move, and attach PDFs (or other files) to Zotero items, sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.), and extract PDF annotations.
4.06k stars 282 forks source link

Use yyyy-mm-dd as date for PDF extraction #480

Closed argenos closed 4 years ago

argenos commented 4 years ago

Would it be possible to format the date as yyyy-mm-dd?

https://github.com/jlegewie/zotfile/blob/5540f522d851c2f091b382531fb6e883060743fe/chrome/content/zotfile/pdfAnnotations.js#L233

I can open a PR with the changes, but I'd like to ask what would be the preferred way to handle the preferences: https://github.com/jlegewie/zotfile/blob/5540f522d851c2f091b382531fb6e883060743fe/defaults/preferences/defaults.js#L130

Would substituting the existing preference for a string-based one, and substituting the ternary operator above for a switch case be alright?

// where predefined_options can be any of 'locale', 'utc' 'ISO' or 'yyyy-mm-dd' 
pref("extensions.zotfile.pdfExtraction.dateFormat", "<predefined_options>"); 

Or would it be best to pass a different wildcard here, such as {'title': str_title, 'date': date_str, 'isodate': iso_date}: `https://github.com/jlegewie/zotfile/blob/5540f522d851c2f091b382531fb6e883060743fe/chrome/content/zotfile/pdfAnnotations.js#L234