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

standardize_to_milliseconds doesn't work if value has a trailing zero #45

Closed
brettrp opened this issue May 1, 2019 · 1 comment
Closed

Comments

@brettrp
Copy link

brettrp commented May 1, 2019

This

      def self.standardize_to_milliseconds(value)
        return standardize_float_to_milliseconds(value.to_f) if value.to_f.to_s == value.to_s
        return standardize_string_to_milliseconds(value)
        value
      end

doesn't work if value has a trailing zero (e.g. 123.450) and it will return a string instead of an integer.

Here's a suggested fix:

   return standardize_float_to_milliseconds(value.to_f) if value =~ /^\d+\.?\d*$/
@NorseGaud
Copy link
Collaborator

Good catch. I'll have a fix in this weekend

@NorseGaud NorseGaud mentioned this issue May 10, 2019
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

2 participants