export const changeDateType = {
    data() {
       
        return {
            
        }
    },
    methods: {
        getDate(time,type){
            let Y = time.getFullYear()
            let M = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1)
            let D = time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate()
            var date = Y + '-' + M + '-' + D

                if(type == 'datetime'){
                    let hours = time.getHours()< 10 ? ('0' + time.getHours()) : time.getHours()
                    let minutes = time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes()
                    let seconds = time.getSeconds() < 10 ? ('0' + time.getSeconds()) : time.getSeconds()
                    date = date + ' ' + hours + ':' + minutes + ':' + seconds
                }
            
            
            console.log(date)
            return Date.parse(date)
        }
    },
}


// export const getDate = (time, type) => {
//             let Y = time.getFullYear()
//             let M = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1)
//             let D = time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate()
//             var date = Y + '-' + M + '-' + D
//             if(type){
//                 if(type == 'datetime'){
//                     let hours = time.getHours()< 10 ? ('0' + time.getHours()) : time.getHours()
//                     let minutes = time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes()
//                     let seconds = time.getSeconds() < 10 ? ('0' + time.getSeconds()) : time.getSeconds()
//                     date = date + ' ' + hours + ':' + minutes + ':' + seconds
//                 }
//             }
            
//             console.log(date)
//             return Date.parse(date)
//   }