// 手机号脱敏处理
export const formatPhoneNumber = (phoneNumber, showFull = false) => {
  if (!phoneNumber) return ''
  const phone = phoneNumber.toString()
  if (phone.length !== 11) return phone
  
  if (showFull) {
    return phone
  } else {
    return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
  }
}

// 时间格式转换，将T替换为空格
export const formatDateTime = (dateTime) => {
  if (!dateTime) return ''
  return dateTime.toString().replace('T', ' ')
}

// 时间戳转换为格式化日期
export const formatTimestamp = (timestamp) => {
  if (!timestamp) return ''
  const date = new Date(timestamp)
  return date.toISOString().replace('T', ' ').slice(0, 19)
}
