提交 50b37763 编写于 作者: B baiy 提交者: ninecents

移除 formatDate

上级 9ce583b3
......@@ -25,27 +25,6 @@ export const openTab = function (url) {
chrome.tabs.create({url: url, selected: true});
};
export const formatDate = function (date, fmt = "yyyy-MM-dd hh:mm:ss") {
let o = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (let k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
}
return fmt;
};
export const env = function (key) {
return process['ctool'][key] ? process['ctool'][key] : "";
};
......
......@@ -26,7 +26,7 @@
<script>
import cronstrue from 'cronstrue/i18n';
import parser from 'cron-parser';
import {formatDate} from "../../helper";
import moment from "moment"
export default {
computed: {
......@@ -38,7 +38,8 @@
list.push("\n最近10次执行时间");
let interval = parser.parseExpression(this.current.input);
for (let i = 1; i <= 10; i++) {
list.push(`第${i}次: ` + formatDate(new Date(interval.next().toString())))
console.log(interval.next().toString())
list.push(`第${i}次: ` + moment(interval.next().toString()).format("YYYY-MM-DD HH:mm:ss"))
}
this.$saveToolData(this.current);
} catch (err) {
......
......@@ -48,7 +48,7 @@
</Row>
</template>
<script>
import {formatDate} from "../../helper";
import moment from 'moment'
export default {
created() {
......@@ -84,7 +84,7 @@
this.lists = [];
},
log(content, type = "other") {
this.lists.push({content, type,time:formatDate(new Date())});
this.lists.push({content, type,time:moment().format("YYYY-MM-DD HH:mm:ss")});
this.$nextTick(() => {
let log = document.getElementById('log');
log.scrollTop = log.scrollHeight;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册