import moment from "moment";
export function getTimeCountInterval(t1) {
    const start = moment(t1);
    const end = moment();
    if (end.isAfter(start)) {
        return {
            timeCounterInterval: 1,
            timeLeft: 0
        };
    }
    const duration = moment.duration(start.diff(end));
    const days = Math.floor(duration.asDays());
    const hours = duration.hours();
    const minutes = duration.minutes();
    const seconds = duration.seconds();
    return {
        timeCounterInterval: (days > 1 && hours > 1) ? 60 * 60 : ((hours * 60 + minutes) > 1 ? 60 : 1),
        timeLeft: (days || hours || minutes) > 1 ? 60 : seconds
    };
}
export const getDevice = () => {
    let userAgent = window.navigator.userAgent;
    if (userAgent.toLowerCase().match(/android/i)) {
        return 'Android';
    }
    if (userAgent.toLowerCase().match(/iphone/i)) {
        return 'iPhone';
    }
    if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
        return 'iPad';
    }
    return 'PC';
};
