Commit 7bda48c1 authored by SpinShare's avatar SpinShare

fixed empty dates

parent 516b0d0f
...@@ -9,7 +9,7 @@ import { ipcRenderer } from 'electron'; ...@@ -9,7 +9,7 @@ import { ipcRenderer } from 'electron';
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.filter('formatDate', function(value) { Vue.filter('formatDate', function(value) {
if (value) { if (value && !String(value).includes("-0001")) {
return moment(String(value)).format(i18n.t('locale.dateFormat')) return moment(String(value)).format(i18n.t('locale.dateFormat'))
} }
}); });
......
...@@ -56,12 +56,12 @@ ...@@ -56,12 +56,12 @@
<img src="@/assets/img/difficultyXD.svg" :class="hasXDDifficulty ? 'active' : ''" alt="xD Difficulty" /> <img src="@/assets/img/difficultyXD.svg" :class="hasXDDifficulty ? 'active' : ''" alt="xD Difficulty" />
</div> </div>
</div> </div>
<div class="stat"> <div class="stat" v-if="uploadDate">
<div class="icon"> <div class="icon">
<i class="mdi mdi-calendar-clock"></i> <i class="mdi mdi-calendar-clock"></i>
</div> </div>
<div class="content"> <div class="content">
{{ uploadDate.date | formatDate}} {{ uploadDate }}
</div> </div>
</div> </div>
<div class="stat"> <div class="stat">
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
<script> <script>
import { remote } from 'electron'; import { remote } from 'electron';
import path from 'path'; import path from 'path';
import moment from 'moment';
import fs from 'fs'; import fs from 'fs';
const { clipboard, shell } = remote; const { clipboard, shell } = remote;
...@@ -152,6 +153,7 @@ ...@@ -152,6 +153,7 @@
tags: [], tags: [],
uploader: null, uploader: null,
uploadDate: null, uploadDate: null,
uploadDateValid: false,
fileReference: "", fileReference: "",
isInstalled: false, isInstalled: false,
previewPath: "", previewPath: "",
...@@ -190,7 +192,7 @@ ...@@ -190,7 +192,7 @@
this.$data.downloads = data.data.downloads; this.$data.downloads = data.data.downloads;
this.$data.views = data.data.views; this.$data.views = data.data.views;
this.$data.description = data.data.description; this.$data.description = data.data.description;
this.$data.uploadDate = data.data.uploadDate; this.$data.uploadDate = moment(data.data.uploadDate.date).format(this.$t('locale.dateFormat'));
this.$data.fileReference = data.data.fileReference; this.$data.fileReference = data.data.fileReference;
// Check if Song is already installed by searching for the srtb file // Check if Song is already installed by searching for the srtb file
...@@ -204,12 +206,14 @@ ...@@ -204,12 +206,14 @@
this.$router.push({ name: 'Error', params: { errorCode: data.status } }); this.$router.push({ name: 'Error', params: { errorCode: data.status } });
} }
}).catch((error) => { }).catch((error) => {
console.error(error);
this.$router.push({ name: 'Error', params: { errorCode: 500 } }); this.$router.push({ name: 'Error', params: { errorCode: 500 } });
}); });
} else { } else {
this.$router.push({ name: 'Error', params: { errorCode: data.status } }); this.$router.push({ name: 'Error', params: { errorCode: data.status } });
} }
}).catch((error) => { }).catch((error) => {
console.error(error);
this.$router.push({ name: 'Error', params: { errorCode: 500 } }); this.$router.push({ name: 'Error', params: { errorCode: 500 } });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment