parent
3bc46f39a6
commit
399d6c06d2
@ -0,0 +1,30 @@
|
||||
import Vue from 'vue'
|
||||
Vue.filter("formatDate", function formatDate(value) {
|
||||
var date = new Date(value);
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
var day = date.getDate();
|
||||
if (month < 10) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (day < 10) {
|
||||
day = "0" + day;
|
||||
}
|
||||
return year + "-" + month + "-" + day;
|
||||
});
|
||||
Vue.filter("formatDateTime", function formatDateTime(value) {
|
||||
var date = new Date(value);
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
var day = date.getDate();
|
||||
var hours = date.getHours();
|
||||
var minutes = date.getMinutes();
|
||||
if (month < 10) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (day < 10) {
|
||||
day = "0" + day;
|
||||
}
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
|
||||
});
|
||||
|
Loading…
Reference in new issue