#218 Wrong duration with german number format

Minor
closed
MRBS (194)
5
2012-08-01
2011-06-08
macservo
No

If the browser language is set to german, an entry with an duration of x.5 hours will show up with an duration of x hours in view_entry.
(i.e. an entry with a real duration of 2.5 hours, will be shown with "Dauer: 2 Stunden" (translation: Duration: 2 hours))

The problem seems to be the following lines in functions.inc:
180 $dur = sprintf('%.3f', $dur);
181 $dur = (string) (float) $dur; // removes trailing zeros

MRBS 1.4.5
MySQL 5.1.44
PHP: 5.3.2
Apache: 2.0.63

Discussion

  • Thanks for spotting this. Yes, you're right, the problem is line 181. Replace it with

    $dur = rtrim($dur, '0');  // removes trailing zeros
    

    I have fixed this in the trunk - Rev 1836.

    Campbell

     


Anonymous


Cancel   Add attachments