'text() not showing/rendered on iOS jQuery

Currently, I am making scanning function in my website.
And there is different time between last scan time and current time.
My script work normally in desktop browser and android browser, but it not showing same in iOS

Here is my code.

Example output in desktop and android devices

1 Hr 2 mins 1 sec ago

desktop

Example output in iOS ( chrome, Firefox and safari give same output )

ago

iOS

Only ago text show in iOS.
anyone know what's wrong with my code?

d = 74;
var h = Math.floor(d / 3600);
var m = Math.floor(d % 3600 / 60);
var s = Math.floor(d % 3600 % 60);
var hDisplay = h > 0 ? h + (h == 1 ? " hr" : " hrs") + (m > 0 || s > 0 ? ", " : "") : "";
var mDisplay = m > 0 ? m + (m == 1 ? " min" : " mins") + (s > 0 ? ", " : "") : "";
var sDisplay = s > 0 ? s + (s == 1 ? " sec" : " secs") : "";

differentTime = "last scan " + hDisplay + mDisplay + sDisplay + " ago "

console.log(differentTime)
$("#last-scan").text(differentTime);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>


<span id="last-scan" class='last-scan-text'> </span><span>by Scanner_19022 </span>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source