
import {  ref } from "vue";
let beginTimeStrap = 1646988300000
let endTimeStrap = 1646985600000
function getTimeStr(timeStrap: number) {
    let timer = new Date(timeStrap)
    let str = `${timer.getMinutes()}:${timer.getSeconds()}`
    return str

}
export let countdownTimer =ref(0)
export let countdown = () => {
    return new Promise((_resolve, _reject) => {
     countdownTimer.value = window.setInterval(() => {
            beginTimeStrap = beginTimeStrap - 1000
            countdownTime.value = getTimeStr(beginTimeStrap)
            if (beginTimeStrap == endTimeStrap) {
                _resolve(countdownTimer.value)
            }
        }, 1000)
    })
}





export let countdownTime = ref("45:00")




