Closed jamieide closed 3 months ago
Maybe I can add a month and day wildcard? That way with the optional wildcards it can fallback to a user-defined format.
Please try the pre-release 1.0.0.3 (https://github.com/wileyyugioh/zotmoov/releases/tag/1.0.0.3) and let me know if you have any issues or encounter any bugs.
Your subdirectory string can be written as
{%c}/{%y}{-%m} - {%t}
Thanks for the quick response! %m does not seem to be working for me. For example, I have an item dated 1927-01-21 and the pattern is set to {%c}/{%y}-{%m}-{%r} - {%t}. ZotMoov moves this to "1927--21 - Half-way house road completed". The month is missing. %M does work.
I can see it implemented in the code but I'm not familiar enough with Zotero to know where it's failing.
Can you please select the item in Zotero. Then go to Tools > Developer > Error Console and type:
var as = Zotero.getActiveZoteroPane().getSelectedItems();
as[0].getField('date', false, true);
and
Zotero.Date.strToDate(as[0].getField('date', false, true));
and see what the console outputs?
And by item I mean the Zotero citation, not the PDF or other kinds of files like that.
It fails for January because the month is 0 so (item_fields['date'].month)
evaluates to false which causes
result = (item_fields['date'].month) ? String(item_fields['date'].month + 1).padStart(2, '0') : '';
to return empty string. It works for every other month. I think the solution is to check item_fields['date'].month == null
will returns false if month is null or undefined.
JavaScript is so much fun. Thanks!
var as = Zotero.getActiveZoteroPane().getSelectedItems();
as[0].getField('date', false, true);
"1927-01-21"
Zotero.Date.strToDate(as[0].getField('date', false, true));
Object { order: "ymd", year: "1927", month: 0, day: 21 }
var as = Zotero.getActiveZoteroPane().getSelectedItems();
as[0].getField('date', false, true);
"1936-12-02"
Zotero.Date.strToDate(as[0].getField('date', false, true));
Object { order: "ymd", year: "1936", month: 11, day: 2 }
Thanks for catching that! Can you please try https://github.com/wileyyugioh/zotmoov/releases/tag/1.0.0.4 and see if the issue is fixed?
That works fine, thank you!
Add a full date wildcard. The behavior would be to use the full date if available, falling back to yyyy-mm or yyyy if not. I could take a stab at this and submit a pull request. Since %D and %d are already used, my suggestion is %g (for Gregorian, the best I could come up with).
I work with newspaper clippings and I'd like my directory structure to include the full date of publication. I'm currently using year ({%c}/{%y} - {%t}) which is okay but I'd prefer the complete date.
edit: I neglected to mention how much I appreciate this plug-in. It's saved me hours of work and kept me organized. Thanks!