diff --git a/frontend/src/performance/components/common/filter/TimestampFormatDateFilter.js b/frontend/src/performance/components/common/filter/TimestampFormatDateFilter.js new file mode 100644 index 0000000000..678f3b9de3 --- /dev/null +++ b/frontend/src/performance/components/common/filter/TimestampFormatDateFilter.js @@ -0,0 +1,27 @@ +let timestampFormatDate = function (timestamp) { + if (!timestamp) { + return timestamp + } + + let date = new Date(timestamp); + + let y = date.getFullYear(); + + let MM = date.getMonth() + 1; + MM = MM < 10 ? ('0' + MM) : MM; + + let d = date.getDate(); + d = d < 10 ? ('0' + d) : d; + + let h = date.getHours(); + h = h < 10 ? ('0' + h) : h; + + let m = date.getMinutes(); + m = m < 10 ? ('0' + m) : m; + + let s = date.getSeconds(); + s = s < 10 ? ('0' + s) : s; + + return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s +}; +export default timestampFormatDate diff --git a/frontend/src/performance/components/testPlan/components/BasicConfig.vue b/frontend/src/performance/components/testPlan/components/BasicConfig.vue index b5176eeacc..873008607f 100644 --- a/frontend/src/performance/components/testPlan/components/BasicConfig.vue +++ b/frontend/src/performance/components/testPlan/components/BasicConfig.vue @@ -1,12 +1,52 @@ diff --git a/frontend/src/performance/main.js b/frontend/src/performance/main.js index db085981a7..60d5aeca91 100644 --- a/frontend/src/performance/main.js +++ b/frontend/src/performance/main.js @@ -7,6 +7,7 @@ import ajax from "../common/ajax"; import App from './App.vue'; import router from "./components/router/router"; import i18n from "../i18n/i18n"; +import timestampFormatDate from "./components/common/filter/TimestampFormatDateFilter"; Vue.config.productionTip = false; Vue.use(icon); @@ -16,6 +17,9 @@ Vue.use(ElementUI, { Vue.use(filters); Vue.use(ajax); +// filter +Vue.filter('timestampFormatDate', timestampFormatDate); + new Vue({ el: '#app', router,