File tree Expand file tree Collapse file tree 5 files changed +32
-0
lines changed
Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ export default defineComponent({
7575 type : Number ,
7676 required : true ,
7777 } ,
78+ totalPlaylistDuration : {
79+ type : Number ,
80+ required : true
81+ } ,
7882 lastUpdated : {
7983 type : String ,
8084 default : undefined ,
@@ -123,6 +127,18 @@ export default defineComponent({
123127 }
124128 } ,
125129 computed : {
130+ currentLocale : function ( ) {
131+ return this . $i18n . locale
132+ } ,
133+ durationFormatted : function ( ) {
134+ const duration = {
135+ hours : Math . floor ( this . totalPlaylistDuration / 3600 ) ,
136+ minutes : Math . floor ( ( this . totalPlaylistDuration % 3600 ) / 60 ) ,
137+ seconds : this . totalPlaylistDuration % 60 ,
138+ }
139+
140+ return new Intl . DurationFormat ( [ this . currentLocale , 'en' ] , { style : 'short' } ) . format ( duration )
141+ } ,
126142 hideSharingActions : function ( ) {
127143 return this . $store . getters . getHideSharingActions
128144 } ,
Original file line number Diff line number Diff line change 7777 {{ $t("Playlist.Last Updated On") }}
7878 </span >
7979 {{ lastUpdated }}
80+ <template v-if =" durationFormatted !== ' ' " >
81+ <br >
82+ {{ $t('User Playlists.TotalTimePlaylist', { duration: durationFormatted }) }}
83+ </template >
8084 </p >
8185 </template >
8286 </div >
Original file line number Diff line number Diff line change @@ -243,6 +243,15 @@ export default defineComponent({
243243 sortBySelectValues ( ) {
244244 return this . sortByValues
245245 } ,
246+ totalPlaylistDuration ( ) {
247+ const totalSeconds = this . playlistItems . reduce ( ( acc , video ) => {
248+ if ( typeof video . lengthSeconds !== 'number' ) {
249+ return NaN
250+ }
251+ return acc + video . lengthSeconds
252+ } , 0 )
253+ return totalSeconds
254+ } ,
246255 } ,
247256 watch : {
248257 $route ( ) {
Original file line number Diff line number Diff line change 2828 :video-count =" videoCount"
2929 :videos =" playlistItems"
3030 :view-count =" viewCount"
31+ :total-playlist-duration =" totalPlaylistDuration"
3132 :info-source =" infoSource"
3233 :more-video-data-available =" moreVideoDataAvailable"
3334 :search-video-mode-allowed =" isUserPlaylistRequested && videoCount > 1"
Original file line number Diff line number Diff line change @@ -195,6 +195,8 @@ User Playlists:
195195 Cannot delete the quick bookmark target playlist. : Cannot delete the quick bookmark target playlist.
196196 Are you sure you want to delete this playlist? This cannot be undone : Are you sure you want to delete this playlist? This cannot be undone.
197197
198+ TotalTimePlaylist : " Total time: {duration}"
199+
198200 Sort By :
199201 NameAscending : ' A-Z'
200202 NameDescending : ' Z-A'
You can’t perform that action at this time.
0 commit comments