Time shows as Nan on iPhone ONLY

I am not sure why my time left show as NaN when I view it on

iPhone

enter image description here

Mobile Simulator in Chrome showed working

enter image description here

Desktop

I’ve also checked it out on Chrome Desktop mode. It’s working as you can see.

enter image description here

I even tried an experiment the same code I use in jsfiddle

https://jsfiddle.net/bheng/7w8cftyL/

It’s working there too!

Does anyone else face this issue too?


Code

<div class="timeLeft"></div>




function timeDiffCalc(dateFuture, dateNow) {
    let diffInMilliSeconds = Math.abs(dateFuture - dateNow) / 1000;

    const days = Math.floor(diffInMilliSeconds / 86400);
    diffInMilliSeconds -= days * 86400;
    console.log('calculated days', days);

    const hours = Math.floor(diffInMilliSeconds / 3600) % 24;
    diffInMilliSeconds -= hours * 3600;
    console.log('calculated hours', hours);

    const minutes = Math.floor(diffInMilliSeconds / 60) % 60;
    diffInMilliSeconds -= minutes * 60;
    console.log('minutes', minutes);

    let difference = '';
    if (days > 0) {
        difference += (days === 1) ? `${days} day, ` : `${days} days, `;
    }

    difference += (hours === 0 || hours === 1) ? `${hours} hour, ` : `${hours} hours, `;

    difference += (minutes === 0 || hours === 1) ? `${minutes} minutes` : `${minutes} minutes`; 

    return difference;
}


var timeLeft = timeDiffCalc(new Date('2021-02-17 20:44:50'), new Date()); 
$('.timeLeft').text(timeLeft + " more..."); 

Live code/result

https://www.bunlongheng.com/norden?code=l!ght

8 thoughts on “Time shows as Nan on iPhone ONLY”

  1. community first credit union fl community bank jobs near me , ivermectin tablets uk [url=http://ivermectinsale.me/#]Ivermectin for sale[/url] community definition a level biology. community advocates milwaukee locations community bank gouverneur ny . positive correlation hypothesis DГіnde comprar Noroxin 400 mg, Comprar Noroxin medicamento. Comprar Noroxin sin receta Comprar Noroxin genГ©rico [url=https://kit.co/orpleden/comprar-noroxin-generico-donde-comprar-noroxin-400-mg#]Comprar Noroxin sin receta[/url] , positive discipline positive affirmations louise hay friends pictures [url=http://mmonly.cn/web/viewtopic.php?p=214061#214061]community college to ivy league spain[/url] 9e4635f , community aid hanover pa , community leader synonym .

    Reply

Leave a Comment