MomentSharp icon indicating copy to clipboard operation
MomentSharp copied to clipboard

Moment.From() : wrong number ranges

Open ichinm opened this issue 5 years ago • 0 comments

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); }

ichinm avatar Jun 20 '19 10:06 ichinm