diff --git a/package.json b/package.json index 7b5bc878..721c2650 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "@silvermine/videojs-quality-selector": "^1.2.5", "autolinker": "^3.15.0", "bulma-pro": "^0.2.0", - "dateformat": "^4.5.1", "electron-context-menu": "^3.1.2", "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", diff --git a/src/renderer/store/modules/ytdl.js b/src/renderer/store/modules/ytdl.js index db8895db..b9fa01b8 100644 --- a/src/renderer/store/modules/ytdl.js +++ b/src/renderer/store/modules/ytdl.js @@ -7,6 +7,8 @@ import { SocksProxyAgent } from 'socks-proxy-agent' import { HttpsProxyAgent } from 'https-proxy-agent' import { HttpProxyAgent } from 'http-proxy-agent' +import i18n from '../../i18n/index' + const state = { isYtSearchRunning: false } @@ -288,10 +290,15 @@ const actions = { break } } - const locale = settings.currentLocale.replace('-', '_') + let locale = i18n.locale.replace('_', '-') + + if (locale === 'nn') { + locale = 'no' + } + ytpl(playlistId, { hl: locale, - limit: 'Infinity', + limit: Infinity, requestOptions: { agent } }).then((result) => { resolve(result) diff --git a/src/renderer/views/Playlist/Playlist.js b/src/renderer/views/Playlist/Playlist.js index e706fa11..8b754d31 100644 --- a/src/renderer/views/Playlist/Playlist.js +++ b/src/renderer/views/Playlist/Playlist.js @@ -1,11 +1,11 @@ import Vue from 'vue' import { mapActions } from 'vuex' -import dateFormat from 'dateformat' import FtLoader from '../../components/ft-loader/ft-loader.vue' import FtCard from '../../components/ft-card/ft-card.vue' import PlaylistInfo from '../../components/playlist-info/playlist-info.vue' import FtListVideo from '../../components/ft-list-video/ft-list-video.vue' import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue' +import i18n from '../../i18n/index' export default Vue.extend({ name: 'Playlist', @@ -36,6 +36,9 @@ export default Vue.extend({ }, currentInvidiousInstance: function () { return this.$store.getters.getCurrentInvidiousInstance + }, + currentLocale: function () { + return i18n.locale.replace('_', '-') } }, watch: { @@ -134,8 +137,7 @@ export default Vue.extend({ } const dateString = new Date(result.updated * 1000) - dateString.setDate(dateString.getDate() + 1) - this.infoData.lastUpdated = dateFormat(dateString, 'mmm dS, yyyy') + this.infoData.lastUpdated = dateString.toLocaleDateString(this.currentLocale, { year: 'numeric', month: 'short', day: 'numeric' }) this.playlistItems = this.playlistItems.concat(result.videos) diff --git a/yarn.lock b/yarn.lock index 4104a3d0..b1cb740c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3177,11 +3177,6 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -dateformat@^4.5.1: - version "4.6.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5" - integrity sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA== - de-indent@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"