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

Moment.From() : wrong number ranges #10

Open
ichinm opened this issue Jun 20, 2019 · 0 comments
Open

Moment.From() : wrong number ranges #10

ichinm opened this issue Jun 20, 2019 · 0 comments

Comments

@ichinm
Copy link

ichinm commented Jun 20, 2019

Dear,

I got an exception: Couldn't find an exceptable range to return!!!

Because the timeSpan.Total[...] is double but they are treated as int.

E.g. TotalSeconds=45.5 will throws exception.

if (timeSpan.TotalSeconds.InRange(0, 45)) // 0-45 seconds
{
return language.Translate(RelativeTime.Seconds, timeSpan.Seconds, showSuffix, isFuture);
}
if (timeSpan.TotalSeconds.InRange(46, 90)) // 46-90 seconds
{
return language.Translate(RelativeTime.Minute, timeSpan.Minutes, showSuffix, isFuture);
}

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