diff --git a/src/renderer/components/ft-list-video/ft-list-video.js b/src/renderer/components/ft-list-video/ft-list-video.js index 7afe052fa25d6..5e1b17776ed95 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.js +++ b/src/renderer/components/ft-list-video/ft-list-video.js @@ -417,7 +417,13 @@ export default defineComponent({ this.viewCount = this.data.viewCount if (typeof this.data.premiereDate !== 'undefined') { - this.publishedText = this.data.premiereDate.toLocaleString() + let premiereDate = this.data.premiereDate + + // premiereDate will be a string when the subscriptions are restored from the cache + if (typeof premiereDate === 'string') { + premiereDate = new Date(premiereDate) + } + this.publishedText = premiereDate.toLocaleString() } else if (typeof (this.data.premiereTimestamp) !== 'undefined') { this.publishedText = new Date(this.data.premiereTimestamp * 1000).toLocaleString() } else { @@ -463,7 +469,7 @@ export default defineComponent({ // Using `Math.ceil` so that -1.x days ago displayed as 1 day ago // Notice that the value is turned to negative to be displayed as "ago" this.uploadedTime = new Intl.RelativeTimeFormat(this.currentLocale).format(Math.ceil(-timeDiffFromNow), timeUnit) - } else if (typeof (this.data.publishedText) !== 'undefined' && this.data.publishedText !== null && !this.isLive) { + } else if (this.publishedText && !this.isLive) { // produces a string according to the template in the locales string this.uploadedTime = toLocalePublicationString({ publishText: this.publishedText, diff --git a/src/renderer/views/Subscriptions/Subscriptions.js b/src/renderer/views/Subscriptions/Subscriptions.js index 48a896d566c46..f18f88adb3730 100644 --- a/src/renderer/views/Subscriptions/Subscriptions.js +++ b/src/renderer/views/Subscriptions/Subscriptions.js @@ -282,6 +282,8 @@ export default defineComponent({ videos.map(video => { if (video.liveNow) { video.publishedDate = new Date().getTime() + } else if (video.isUpcoming) { + video.publishedDate = video.premiereDate } else { video.publishedDate = calculatePublishedDate(video.publishedText) }