RE: RE: JavaScript开发笔记
You are viewing a single comment's thread from:

RE: JavaScript开发笔记

Words
0
Reading
0 min
Listen
Play
7M
const formatSeconds = function(value){
  let theTime = parseInt(value)
  let minutes = 0
  let hours = 0

  if(theTime > 60) {
    minutes = parseInt(theTime/60)
    theTime = parseInt(theTime%60)
    if(minutes > 60) {
      hours = parseInt(minutes/60)
      minutes = parseInt(minutes%60)
    }
  }
  // let result = ""
  // let result = ""+parseInt(theTime)+this.$t('message.seconds')
  let result = ""+parseInt(theTime)+"秒"
  if(minutes > 0) {
    // result = ""+parseInt(minutes)+this.$t('message.minutes') +result
    result = ""+parseInt(minutes)+ "分" +result
  }
  if(hours > 0) {
    // result = ""+parseInt(hours)+this.$t('message.hours')+result
    result = ""+parseInt(hours)+"小时"+result
  }
  return result
}
@lemooljiang: const formatSeconds | Ecency