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

Use dashes to format invalid times #627

Closed
wants to merge 2 commits into from
Closed

Conversation

dmlap
Copy link
Member

@dmlap dmlap commented Jul 8, 2013

If the number of seconds to be formatted is NaN or Infinity, use dashes to substitute for the digits.

dmlap added 2 commits July 8, 2013 18:01
If the number of seconds to be formatted is NaN or Infinity, use dashes to substitute for the digits.
Make sure it isn't mangled by Google closure.
var s = Math.floor(seconds % 60),
m = Math.floor(seconds / 60 % 60),
h = Math.floor(seconds / 3600),
gm = Math.floor(guide / 60 % 60),
gh = Math.floor(guide / 3600);

// handle invalid times
if (window['isNaN'](seconds) || seconds === Infinity) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find the window and quotes in window['isNaN'] was actually needed? I would expect closure compiler to be aware of isNaN via the default externs and not mess with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had one failed build in Travis because I assumed the same. Maybe it wouldn't have if I had used isNaN without de-refing from window-- I didn't try that.

@heff heff closed this in f515ac0 Aug 26, 2013
heff added a commit that referenced this pull request Aug 26, 2013
@heff
Copy link
Member

heff commented Aug 26, 2013

Right now it shows -:-:- for hours:minutes:seconds, whereas -:--:-- would be more of an accurate placeholder. Trying to decide if it's worth the extra effort.

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

Successfully merging this pull request may close these issues.

2 participants