Added date fallback configuration to summary templates, disabled by default.

This commit is contained in:
DebaucheryLibrarian 2025-03-18 00:42:40 +01:00
parent a8ceb41f02
commit 8e9af7d6c4
2 changed files with 14 additions and 1 deletions

View File

@ -12,3 +12,4 @@
genders: fmtou
- key: date
format: yyyy-MM-dd
fallbackToAdded: false

View File

@ -40,7 +40,19 @@ const propProcessors = {
})
.map((tag) => tag.name),
movie: (sceneInfo) => sceneInfo.movies?.[0]?.title,
date: (sceneInfo, options) => (sceneInfo.effectiveDate ? format(sceneInfo.effectiveDate, options.format || 'yyyy-MM-dd') : ''),
date: (sceneInfo, options) => {
const dateFormat = options.format || 'yyyy-MM-dd';
if (sceneInfo.date) {
return format(sceneInfo.date, dateFormat);
}
if (options.fallbackToAdded && sceneInfo.effectiveDate) {
return format(sceneInfo.effectiveDate, dateFormat);
}
return '';
},
};
function curateValue(value, item) {