h4kuna / data-type

Basic data type
7 stars 1 forks source link

Floats :: fromString error with nagative Time Value #7

Closed ickbinhier closed 6 years ago

ickbinhier commented 6 years ago

Hello, I have a problem.

When I put in a negative string ("-3,5") in Floats :: fromString I get the correct float value (-3.5). When I put in a negative string time ("-3:30") in Floats :: fromString I get a wrong float value (-2.5).

I think the calculation he is doing is the following: -3:30 > -3 Hour and 30 Minute -3 + 30 is 2,5 Hour

I think you have to subtract the minutes instead of adding.

https://github.com/h4kuna/data-type/blob/master/src/Basic/Floats.php#L54

h4kuna commented 6 years ago

Good point, you expected -3.5?

I will fix it.

h4kuna commented 6 years ago

Fixed in version 2.1.6

h4kuna commented 6 years ago

Thank you @ickbinhier