diff options
Diffstat (limited to 'static/js/timeago.ts')
-rw-r--r-- | static/js/timeago.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/static/js/timeago.ts b/static/js/timeago.ts index 2949d44..9cc5370 100644 --- a/static/js/timeago.ts +++ b/static/js/timeago.ts @@ -15,10 +15,6 @@ view.right <= (window.innerWidth || self.documentElement.clientWidth) + options.offset; } - function tiny(string, place) { - return string.split(" ").slice(0, place).join(" ") + string.split(" ")[place].charAt(0); - } - const date = function (update) { const elements = document.querySelectorAll("time"); for (let i = 0; i < elements.length; ++i) { @@ -39,6 +35,12 @@ const past = Math.sign(seconds) === 1; const future = Math.sign(seconds) === -1; + let tiny = function (string, place) { + return string.split(" ").slice(0, place).join(" ") + string.split(" ")[place].charAt(0); + } + + if (element.dataset.type === "default") { tiny = function (string) { return string; }; } + if (element.dataset.type === "localDate") { return element.textContent = new Intl.DateTimeFormat([], { dateStyle: "medium", |