import moment from "moment";
export function getTimeDifferFormNow(t1) {
    const start = moment(t1);
    const end = moment();
    if (end.isAfter(start)) {
        return '00:00:00';
    }
    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();
    const dayTimes = days > 0 ? [days, hours, minutes, seconds] : [hours, minutes, seconds];
    // Format with leading zeros
    return dayTimes
        .map(val => ('0' + val).slice(-2))
        .join(':');
}
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';
};
