Created attachment 1187809 [details]
Description of problem:
See attached document and the `SUM Total:` field. In 4.4 (fedora 23) it shows properly as format `[HH]:mm`. But in 5.x (fedora 24) it shows up as `####`.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. open formatbug.ods
2. look at `SUM Total:` field
Try to make the cell a bit wider...
Ok, it shows "something" when it is wider but that something is "12:00:00 AM" instead of "00:00" like it used to show in 4.4.
This file has been created with 4.4 (Fedora 23) and showed "00:00". That to me shows that is a bug as old documents should still show correctly in newer versions.
D54 (and others) have a format [HH]:MM of the Default (system/office) locale applied, D56 has a format HH:MM:SS AM/PM of the English-US locale applied. Check with Ctrl+1 or Format -> Cells.
In fact the document has things stored wrongly. Opening in 4.4 I see the format on D56 being [H]:MM:SS;@ of Default locale. But the cell is not stored as a time cell like the others, it is of office:value-type="float" office:value="0" instead of office:value-type="time" office:time-value="PT00H00M00S". That seems to confuse the format inheritance for the SUM formula and somehow the default format of the currently active locale is applied (not as Default locale but as fixed locale, only this I'd consider a bug).
You can fix the document by applying the correct format once and save again, after which the cell is correctly saved with office:value-type="time" office:time-value="PT00H00M00S"
I quickly figured how to fix the document when I faced the issue (as you suggested setting format). I can't exactly understand what is confused and how from your comment.
I think though that document renders in one way in 4.4 but in 5.1 is not rendered as before. I think it is good to retain compatibility with older LO versions as long as this doesn't harm user experience in other ways.
I'm reopening for the last time. I leave it up to you to decide whether backward compatibility can be fixed or not.
As said, 4.4 apparently stored it broken and determined the format inherited from the other time cells it sums in a different way. I'll see if I can do anything. However, that will likely not go into 5.1 anymore.
I think it makes a lot of sense to inherit format from summed cells. It is likely user expects to have the sum cell by default in same format as source cells.
Not sure how should different formats of source cells be handled. But when all source cells are same format it appears to be a no brainer to me. Or probably I have too little experience with spreadsheets.
Resolved upstream master https://gerrit.libreoffice.org/gitweb?p=core.git;a=commit;h=f2e3de4dfcf10f9a59f8fc3f051c620fd50ef3c2
https://gerrit.libreoffice.org/27916 for 5-2
https://gerrit.libreoffice.org/27917 for 5-1