export function isJSON(str) {
    if (typeof str == 'string') {
        try {
        var obj = JSON.parse(str)
        if (typeof obj == 'object' && obj) {
            return true
        } else {
            return false
        }
        } catch (e) {
        return false
        }
    }
}

export function getDateTime() {
    var date = new Date()
    var hengGang = '-'
    var year = date.getFullYear()
    var month = numToZero(date.getMonth() + 1)
    var curDate = numToZero(date.getDate())
    var hour = numToZero(date.getHours())
    var minute = numToZero(date.getMinutes())
    var second = numToZero(date.getSeconds())
    var currentdate = ''
    currentdate =
      year +
      '-' +
      month +
      '-' +
      curDate +
      ' ' +
      hour +
      ':' +
      minute +
      ':' +
      second
    return currentdate
  }
  function numToZero(value) {
    if (value >= 0 && value <= 9) {
      value = '0' + value
    }
    return value
  }