Yes, there are bugs, quality of life and basic design details that have yet to be implemented or fixed, with custom metadata date fields. We have a big list of them already drawn up, including freeform date field entry that even allows for plain language (like typing in ‘tomorrow’), and inserting dates using the actual format mask being used. The whole calendar interface was always meant to be optional, with the text field being the primary input method. As it stands, if you accidentally double-click a date field in outliner you get stuck with a date you can’t even delete!
Until those things are fixed, I’m afraid the easiest way to work with dates in a bulk fashion is is the XML data itself, which fortunately is not difficult:
- As always, when modifying core data files directly, run a quick
File ▸ Back Up ▸ Back Up To...
and close the project. - Open the project_name.scrivx file in a plain-text or XML editor.
The easiest way to find an existing date you want to copy is to search for the entry it came from by name, which will be something like this:
<Title>Name of Binder Item</Title>
Once you’ve found the BinderItem, look for a ‘./MetaData/CustomMetaData/MetaDataItem/FieldID’ that matches the data field name (sans non-alphanumeric; all lowercase). The ‘MetaDataItem/Value’ will contain the ISO standard date string in one of two formats, depending upon whether the Ignore time zone setting is ticked for the field. Here are two examples:
<CustomMetaData>
<MetaDataItem>
<FieldID>datewithouttimezone</FieldID>
<Value>2022-01-20 17:37:30</Value>
</MetaDataItem>
<MetaDataItem>
<FieldID>timezonedatefield</FieldID>
<Value>2022-01-20 17:37:28 +0100</Value>
</MetaDataItem>
<CustomMetaData>
I don’t know if worlds will explode if you provide a TZ offset on a field that doesn’t use it, or vice versa, I haven’t tested that, but if you’re just propagating data added via the UI, that shouldn’t be an issue.
Given how XML parsing works, you can add or modify full structure in parallel to any that already exists. So your script or search & replace macro could create an amendment to an item that looks like this, in excerpt:
<MetaData>
<IncludeInCompile>Yes</IncludeInCompile>
</MetaData>
<MetaData>
<CustomMetaData>
<MetaDataItem>
<FieldID>timezonedatefield</FieldID>
<Value>2022-01-20 17:37:28 +0100</Value>
</MetaDataItem>
</CustomMetaData>
</MetaData>
The elements will be merged together the next time Scrivener writes the .scrivx file. That will be easier than detecting whether a CustomMetaData field has already been created for an item, anyway.