[+] Format date with moment

This commit is contained in:
Hykilpikonna
2021-12-05 01:25:34 -05:00
parent 20d22c3271
commit 186239cff2
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -19,6 +19,7 @@
<script lang="ts">
import {Options, Vue} from 'vue-class-component';
import {backendUrl} from "@/constants";
import moment from "moment";
export interface Post {
id: string
@@ -53,6 +54,8 @@ export default class Blog extends Vue
{
fetch(`${backendUrl}/posts.json`).then(it => it.json()).then(it => {
this.posts = it
this.posts.forEach(it => it.date = moment(it.date).format('YYYY-MM-DD h:mm'))
this.posts.reverse()
console.log(it)
})
}