提交 d839d84b 编写于 作者: guangjun.yang's avatar guangjun.yang

转换时间格式

上级 4e4fbc22
...@@ -227,23 +227,17 @@ export function getCmsUrl(url) { ...@@ -227,23 +227,17 @@ export function getCmsUrl(url) {
return getConfigByEnvType('cmsUrl') + url return getConfigByEnvType('cmsUrl') + url
} }
// 获取老的cms接口域名地址 // 转换时间格式
export function convertTime(time, isToSlash = true) { export function convertTime(time, isToSlash = true) {
console.log('#########time', time); console.log('#########time', time);
// 2020-04-16 15:06:19 // 2020-04-16 15:06:19
if(!time) { if(!time) {
return '' return ''
} else { } else {
if(typeof time == 'object') { if(isToSlash) {
return time.format("yyyy/MM/dd hh:mm:ss"); return new Date( new Date(time)).format("yyyy/MM/dd hh:mm:ss");
} else { } else {
return new Date(time).format("yyyy/MM/dd hh:mm:ss"); return new Date( new Date(time)).format("yyyy-MM-dd hh:mm:ss");
} }
// // time = time + '';
// if(isToSlash) {
// return time.replace(/-/g, '/')
// } else {
// return time.replace(/\//g, '-')
// }
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册