You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to fix an issue on an existing website that was built a few years ago and originally running version 2.0.2 of jclock (I believe) until I updated it. The developer who originally created this site is long gone and I'm still very new to Javascript.
From what I can tell, they simply have a backend where they can input +1, +2, +3 etc "hours from now" and the clock on the website updates to match the time (http://www.acesamedaycouriers.com/).
The previous developer calls jclock in script.js like this:
jQuery(function(jQuery) {
var startTime = parseInt(jQuery('.jclock').html(), 10) * 1000;
var options = {
format: '%H:%M',
seedTime: startTime
};
jQuery('.jclock').jclock(options);
});
If I comment out the startTime variable and seedTime option, the widget works fine on both the desktop and iOS version. Putting it back in causes Apple devices to display NaN (although, it works fine in Safari). I'm assuming this is because of the way the parseInt line is written and they can't read the output? But I'm not sure what I can do to fix it. Would you have any advice for me?
Thank you!
The text was updated successfully, but these errors were encountered:
Wanted to leave a note for others with a potentially similar problem as I have solved this issue.
iOS outputs as NaN because when the output milliseconds get edited by our Javascript. iOS looks at the milliseconds, decides a number that length is a telephone number and wraps it in a link. Then the JS looks at it and sees a link instead of a number, hence NaN:NaN. Got around this issue with a meta tag in the end.
I'm trying to fix an issue on an existing website that was built a few years ago and originally running version 2.0.2 of jclock (I believe) until I updated it. The developer who originally created this site is long gone and I'm still very new to Javascript.
From what I can tell, they simply have a backend where they can input +1, +2, +3 etc "hours from now" and the clock on the website updates to match the time (http://www.acesamedaycouriers.com/).
The previous developer calls jclock in script.js like this:
jQuery(function(jQuery) {
var startTime = parseInt(jQuery('.jclock').html(), 10) * 1000;
var options = {
format: '%H:%M',
seedTime: startTime
};
jQuery('.jclock').jclock(options);
});
If I comment out the startTime variable and seedTime option, the widget works fine on both the desktop and iOS version. Putting it back in causes Apple devices to display NaN (although, it works fine in Safari). I'm assuming this is because of the way the parseInt line is written and they can't read the output? But I'm not sure what I can do to fix it. Would you have any advice for me?
Thank you!
The text was updated successfully, but these errors were encountered: