diff --git a/assets/summary.yaml b/assets/summary.yaml index debe0a9..b24c4fd 100644 --- a/assets/summary.yaml +++ b/assets/summary.yaml @@ -12,3 +12,4 @@ genders: fmtou - key: date format: yyyy-MM-dd + fallbackToAdded: false diff --git a/utils/process-summary-template.js b/utils/process-summary-template.js index a2f2960..d85ead6 100644 --- a/utils/process-summary-template.js +++ b/utils/process-summary-template.js @@ -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) {