diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/content/dependencies/generateCommentaryEntry.js | 36 | ||||
-rw-r--r-- | src/strings-default.yaml | 8 |
2 files changed, 40 insertions, 4 deletions
diff --git a/src/content/dependencies/generateCommentaryEntry.js b/src/content/dependencies/generateCommentaryEntry.js index f7f04f16..c148d244 100644 --- a/src/content/dependencies/generateCommentaryEntry.js +++ b/src/content/dependencies/generateCommentaryEntry.js @@ -45,6 +45,9 @@ export default { data: (entry) => ({ date: entry.date, + secondDate: entry.secondDate, + dateKind: entry.dateKind, + accessDate: entry.accessDate, accessKind: entry.accessKind, }), @@ -113,11 +116,36 @@ export default { {class: 'text-with-tooltip-interaction-cue'}, {[html.onlyIfContent]: true}, - language.$(titleCapsule, 'date', { - [language.onlyIfOptions]: ['date'], + language.encapsulate(titleCapsule, 'date', workingCapsule => { + const workingOptions = {}; + + if (!data.date) { + return html.blank(); + } + + const rangeNeeded = + data.dateKind === 'sometime' || + data.dateKind === 'throughout'; + + if (rangeNeeded && !data.secondDate) { + workingOptions.date = language.formatDate(data.date); + return language.$(workingCapsule, workingOptions); + } + + if (data.dateKind) { + workingCapsule += '.' + data.dateKind; + } + + if (data.secondDate) { + workingCapsule += '.range'; + workingOptions.dateRange = + language.formatDateRange(data.date, data.secondDate); + } else { + workingOptions.date = + language.formatDate(data.date); + } - date: - language.formatDate(data.date), + return language.$(workingCapsule, workingOptions); })), tooltip: diff --git a/src/strings-default.yaml b/src/strings-default.yaml index c685f1d7..eab080af 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -463,9 +463,17 @@ misc: withAnnotation: "({ANNOTATION})" date: "{DATE}" + date.range: "{DATE_RANGE}" + date.accessed: "accessed {DATE}" date.captured: "captured {DATE}" + date.around: "around {DATE}" + date.around.range: "around {DATE_RANGE}" + + date.sometime.range: "sometime {DATE_RANGE}" + date.throughout.range: "throughout {DATE_RANGE}" + seeOriginalRelease: "See {ORIGINAL}!" # artistLink: |