« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateRelativeDatetimestamp.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateRelativeDatetimestamp.js')
-rw-r--r--src/content/dependencies/generateRelativeDatetimestamp.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/content/dependencies/generateRelativeDatetimestamp.js b/src/content/dependencies/generateRelativeDatetimestamp.js
index 7b7a28de..a997de0e 100644
--- a/src/content/dependencies/generateRelativeDatetimestamp.js
+++ b/src/content/dependencies/generateRelativeDatetimestamp.js
@@ -2,6 +2,7 @@ export default {
   contentDependencies: [
     'generateAbsoluteDatetimestamp',
     'generateDatetimestampTemplate',
+    'generateTooltip',
   ],
 
   extraDependencies: ['html', 'language'],
@@ -11,9 +12,16 @@ export default {
       ? {equal: true, date: currentDate}
       : {equal: false, currentDate, referenceDate}),
 
-  relations: (relation, currentDate) =>
-    ({template: relation('generateDatetimestampTemplate'),
-      fallback: relation('generateAbsoluteDatetimestamp', currentDate)}),
+  relations: (relation, currentDate) => ({
+    template:
+      relation('generateDatetimestampTemplate'),
+
+    fallback:
+      relation('generateAbsoluteDatetimestamp', currentDate),
+
+    tooltip:
+      relation('generateTooltip'),
+  }),
 
   slots: {
     style: {
@@ -43,12 +51,15 @@ export default {
           ? data.currentDate.getFullYear().toString()
           : null),
 
-      tooltipContent:
+      tooltip:
         slots.tooltip &&
-          language.formatRelativeDate(data.currentDate, data.referenceDate, {
-            considerRoundingDays: true,
-            approximate: true,
-            absolute: slots.style === 'year',
+          relations.tooltip.slots({
+            content:
+              language.formatRelativeDate(data.currentDate, data.referenceDate, {
+                considerRoundingDays: true,
+                approximate: true,
+                absolute: slots.style === 'year',
+              }),
           }),
 
       datetime: