Show the absolute time in print style for `<woltlab-core-date-time>`
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 13 Mar 2023 12:47:06 +0000 (13:47 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 13 Mar 2023 12:47:06 +0000 (13:47 +0100)
ts/WoltLabSuite/WebComponent/woltlab-core-date-time.ts
wcfsetup/install/files/js/WoltLabSuite/WebComponent.js

index dd48f38f47093a320e086012ce3f8b0838601f2a..3c660bdf1cea3f8c0bbb1b376d517786196615c2 100644 (file)
 
         const shadow = this.attachShadow({ mode: "open" });
         shadow.append(this.#timeElement);
+
+        const style = document.createElement("style");
+        style.textContent = `
+          @media print {
+            time::after {
+              content: " (" attr(title) ")";
+            }
+          }`;
+        shadow.append(style);
       }
 
       if (updateTitle) {
index 86beb2843beba2e9cfa9a43408d13d170e969e36..89e025a2c8c016ee8a5b648ba249c87ae2f1109c 100644 (file)
           this.#timeElement = document.createElement("time");
           const shadow = this.attachShadow({ mode: "open" });
           shadow.append(this.#timeElement);
+          const style = document.createElement("style");
+          style.textContent = `
+          @media print {
+            time::after {
+              content: " (" attr(title) ")";
+            }
+          }`;
+          shadow.append(style);
         }
         if (updateTitle) {
           this.#timeElement.dateTime = date.toISOString();