From 41ac97ed92369825a1a2f3163400a075ca4e99f4 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 8 Oct 2021 17:52:55 +0100 Subject: [PATCH] Add better upload date formatting. --- src/components/WatchVideo.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index fabfd3c1..f69c3419 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -27,7 +27,7 @@
{{ addCommas(video.views) }} views
-
{{ video.uploadDate }}
+
{{ uploadDate }}
@@ -318,14 +318,24 @@ export default { }, }, computed: { + isListening(_this) { + return _this.getPreferenceBoolean("listen", false); + }, toggleListenUrl(_this) { const url = new URL(window.location.href); - url.searchParams.set("listen", _this.getPreferenceBoolean("listen", false) ? "0" : "1"); + url.searchParams.set("listen", _this.isListening ? "0" : "1"); return url.href; }, isEmbed(_this) { return String(_this.$route.path).indexOf("/embed/") == 0; }, + uploadDate(_this) { + return new Date(_this.video.uploadDate).toLocaleString(undefined, { + month: "short", + day: "numeric", + year: "numeric", + }); + }, }, components: { Player,