After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 509720 - negative time display is broken for cell fomat [h]:mm
negative time display is broken for cell fomat [h]:mm
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Main System
git master
Other All
: Normal enhancement
: ---
Assigned To: Jody Goldberg
Jody Goldberg
: 113845 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-01-15 18:31 UTC by james
Modified: 2009-06-11 19:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Initial patch (5.01 KB, patch)
2008-02-05 21:20 UTC, Morten Welinder
committed Details | Review

Description james 2008-01-15 18:31:49 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.
Comment 1 Morten Welinder 2008-01-15 19:29:21 UTC
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.
Comment 2 james 2008-01-15 19:53:43 UTC
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.
Comment 3 Morten Welinder 2008-02-05 21:20:07 UTC
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.
Comment 4 Morten Welinder 2008-04-11 23:11:38 UTC
*** Bug 113845 has been marked as a duplicate of this bug. ***
Comment 5 Morten Welinder 2008-05-28 00:28:15 UTC
Gnumeric will need attention in st-export.c, function try_auto_date.
Comment 6 Morten Welinder 2008-12-02 13:45:09 UTC
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
Comment 7 Morten Welinder 2008-12-27 01:21:54 UTC
> 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.
Comment 8 Andreas J. Guelzow 2009-06-11 05:51:26 UTC
Might it be time to turn this on in goffice?
Comment 9 Morten Welinder 2009-06-11 19:07:12 UTC
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.