Open mikkovedru opened 1 year ago
In case this is helpful for anyone in the future, I needed this functionality as well so I designed a custom wildcard to output the ISO format. Here it is:
{
"z": {
"field": "date",
"operations": [
{
"function": "replace",
"regex": "([^\\d]*)(\\d{1,2})([^\\d]*)(\\d{1,2})([^\\d]*)(\\d{4})",
"replacement": "$6-0$2-0$4",
"flags": "g"
},
{
"function": "replace",
"regex": "(\\d{4})-\\d?(\\d{2})-\\d?(\\d{2})",
"replacement": "$1-$2-$3",
"flags": "g"
}
]
}
}
You can set this up by following the instructions in the docs:
extensions.zotfile.wildcards.user
itemNow you can use the wildcard %z
anywhere you want the date to appear.
For the programming-minded who may be curious about the strange regexes, I discovered that Zotero seems to use some invisible characters in between the digits in the dates. So it's necessary to isolate them using the ^\\d
sequences. The second replace
operation removes the leading 0
from the month and day that was added in the first operation, in case it doesn't need one.
Currently, Zotfile has different wildcards including the wildcard for a year (
%y
). It's natural and expected that such a field would exist.But sadly many other natural and expected wildcards don't exist:
ISO 8601
format:YYYY-MM-DD
like2023-01-23
.To get those one has to work with the unsupported user-defined wildcards using replace functions, regex, etc. This is a very hard and tedious thing to do for those who know how to do it and it's basically impossible for those who don't.
Could you please add those fields? Are patches welcome or going to be ignored?