1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-13 13:50:27 +05:30

Format numbers with commas.

This commit is contained in:
FireMasterK 2021-06-03 00:22:58 +05:30
parent 366d81a546
commit c594dc51b2
No known key found for this signature in database
GPG Key ID: 8DFF5DD33E93DB58
2 changed files with 7 additions and 3 deletions

View File

@ -10,14 +10,14 @@
<p class="uk-dark"> <p class="uk-dark">
<font-awesome-icon icon="thumbs-up"></font-awesome-icon> <font-awesome-icon icon="thumbs-up"></font-awesome-icon>
<b>{{ video.likes }}</b> <b>{{ addCommas(video.likes) }}</b>
&nbsp; &nbsp;
<font-awesome-icon icon="thumbs-down"></font-awesome-icon> <font-awesome-icon icon="thumbs-down"></font-awesome-icon>
<b>{{ video.dislikes }}</b> <b>{{ addCommas(video.dislikes) }}</b>
</p> </p>
<p> <p>
<font-awesome-icon icon="eye"></font-awesome-icon> <font-awesome-icon icon="eye"></font-awesome-icon>
<b>{{ video.views }}</b> views <b>{{ addCommas(video.views) }}</b> views
</p> </p>
<p> <p>
Uploaded on <b>{{ video.uploadDate }}</b> Uploaded on <b>{{ video.uploadDate }}</b>

View File

@ -49,6 +49,10 @@ const mixin = {
} }
return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol; return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
}, },
addCommas(num) {
num = parseInt(num)
return num.toLocaleString('en-US')
},
fetchJson: function (url, options) { fetchJson: function (url, options) {
return fetch(url, options).then(response => { return fetch(url, options).then(response => {
return response.json(); return response.json();