chore: Add formatting for the view count (#6447)

This commit is contained in:
Pranav Raj S
2023-02-13 14:29:14 -08:00
committed by GitHub
parent caca99a823
commit 98ff185d42
5 changed files with 20 additions and 6 deletions

View File

@@ -29,8 +29,8 @@
</router-link>
</td>
<td>
<span class="fs-small">
{{ views || 0 }}
<span class="fs-small" :title="formattedViewCount">
{{ readableViewCount }}
</span>
</td>
<td>
@@ -95,6 +95,15 @@ export default {
lastUpdatedAt() {
return this.dynamicTime(this.updatedAt);
},
formattedViewCount() {
return Number(this.views || 0).toLocaleString('en');
},
readableViewCount() {
return new Intl.NumberFormat('en-US', {
notation: 'compact',
compactDisplay: 'short',
}).format(this.views || 0);
},
articleAuthorName() {
return this.author.name;
},