forgeplus-react/src/forge/common/util.js

16 lines
508 B
JavaScript
Raw Normal View History

2020-03-30 10:21:22 +08:00
export function truncateCommitId(str) {
2020-06-03 09:56:07 +08:00
if (str && str.length > 11) {
2020-03-30 10:21:22 +08:00
return str.substring(0, 10)
2020-07-27 18:45:18 +08:00
}else{
2020-11-10 16:56:05 +08:00
return str
2020-03-30 10:21:22 +08:00
}
}
2021-09-29 21:04:40 +08:00
// 秒数转2021-9-29 01:01
export function timeFormat(SecondsStr){
const time = new Date(SecondsStr*1000);
const hour = time.getHours()<10?"0".concat(time.getHours()):time.getHours();
const minutes = time.getMinutes()<10?"0".concat(time.getMinutes()):time.getMinutes();
return time.getFullYear()+"-"+(time.getMonth()+1)+"-"+time.getDate()+" "+hour+":"+minutes;
}