GNOME Bugzilla – Bug 509720
negative time display is broken for cell fomat [h]:mm
Last modified: 2009-06-11 19:07:12 UTC
Please describe the problem: The [h]:mm cell format is supposed to display time as the number of hours (not rolling over 24 hours of a day). Until a recent upgrade, if the cell contained a negative amount of time (e.g. "-34:01") the cell would properly format and display the negative sign and the time. I have been doing this for months. In a recent upgrade the cell will not format negative times and instead displays "########...". Steps to reproduce: 1. Select a cell 2. Right-click "format cells" and select Time->[h]:mm 3. Input a negative time such as -1:00 or -25:00 Actual results: After input, the cell displays "##########" Expected results: The cell should display the time with a negative sign such as "-1:00" or "-25:00" Does this happen every time? Yes Other information: I'm not sure which version broke this cell format, but I have confirmed that the bug is NOT present in version 1.6.3 and that it IS present in 1.8.0. I am using Gentoo Linux and these are the only ebuilds available to test.
The ###### behaviour is Excel compatible. Anything negative triggers this when any of the date or time specifiers are used in a format. I'll think about whether we can relax the requirement.
I'd be satisfied with leaving the ##### behaviour for [h]:mm if alternatively there were another custom cell format that _does_ display negative times. If there is one already, I could not easily find it.
Created attachment 104508 [details] [review] Initial patch A first go at a patch for this. This handles the display without, hopefully, making a mess of other cases. Note that Gnumeric functions like HOUR, MONTH, etc. have not been audited and surely do something bizarre for negative arguments. Note that -1h displays very differently as hh:mm and as [h]:mm. The former will produce 23:00, the latter -1:00.
*** Bug 113845 has been marked as a duplicate of this bug. ***
Gnumeric will need attention in st-export.c, function try_auto_date.
For the record, the patch has been committed to goffice now. It is turned off, though. See goffice/utils/go-format.c #undef ALLOW_NEGATIVE_TIMES
> Note that Gnumeric functions like HOUR, MONTH, etc. have not been > audited and surely do something bizarre for negative > arguments. These should be ok now.
Might it be time to turn this on in goffice?
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.