Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaN on iOS #10

Open
retsofcm opened this issue May 27, 2014 · 1 comment
Open

NaN on iOS #10

retsofcm opened this issue May 27, 2014 · 1 comment

Comments

@retsofcm
Copy link

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!

@retsofcm
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant