Bug 151668 - unable to perform calculations on HH:MM:SS fields read from a file
Summary: unable to perform calculations on HH:MM:SS fields read from a file
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-20 22:02 UTC by Pierre Fortin
Modified: 2022-10-21 00:02 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sampling of the file I was trying to process when this issue was discovered (630 bytes, text/csv)
2022-10-20 22:02 UTC, Pierre Fortin
Details
Screnshot import options (58.91 KB, image/png)
2022-10-20 22:30 UTC, m_a_riosv
Details
File after importing with the difference time formulas (18.26 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-10-20 22:31 UTC, m_a_riosv
Details
Screenshot with time in their own column (53.03 KB, image/png)
2022-10-21 00:02 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Fortin 2022-10-20 22:02:57 UTC
Created attachment 183176 [details]
Sampling of the file I was trying to process when this issue was discovered

Found this issue in today's 7.5.0alpha. It exists in 7.4.0.3, so I suspect it exists in all versions; so reporting it against 7.4.0.3.

Calc will not allow calculations of HH:MM:SS fields read in from a file. I can manually enter 12:34:56 data in cells and the calculations work.

Steps to reproduce:
- Open attached file
- Select fixed width (also occurs with Separated by)
- add field separators on either side of the timestamps
- OK
- select any cell with HH:MM:SS -- the Input line shows the content correctly
- insert a column next to the column of timestamps
- Assuming you have the times in column B and the new column at C
  - in C2, enter =b2-b1
  - C2 shows =B2-B1

Issue #1:
  - with the attached file, C2 should display 00:00:00, not =B2-B1

Issue #2:
  - select C2 and double-click on its bottom-right corner to repeat the formula
  - C3 shows =B2-B2 instead of =B3-B2
  - C4 shows =B2-B3 instead of =B4-B3
  - C5 shows =B2-B4 instead of =B5-B4
    etc...  or more correctly, instead of the time differences.
    - the repeat acts like C2 contains =B$2-B1
  Note that the time cells in column B are still showing as 12:34:56

Issue #3:
  - select column B
  - Format>Cells... (hoping this would solve the above)
    Time, 13:37:46, OK
  - Notice that all the B cell contents now have a leading single quote
    This further makes the time calculations unlikely.

Issue #4:
  - It probably wouldn't help; but the "Column type:" selections are lacking in
    the Text Import panel; only a minimal choices are available.

Amazingly, at this point, if I copy column B to an empty column, and create the formulae as above, the calculations work.

So this bug may be covered with an Errata notice until it's resolved.
Comment 1 m_a_riosv 2022-10-20 22:30:03 UTC
Created attachment 183178 [details]
Screnshot import options

With the attached image about import options, it works fine for me.
Comment 2 m_a_riosv 2022-10-20 22:31:41 UTC
Created attachment 183179 [details]
File after importing with the difference time formulas

The file after importing with the formulas to calculate the time difference.
Date and time in the column A.
Comment 3 Pierre Fortin 2022-10-20 23:16:54 UTC
Hmm...  since there is no option for TIME(HMS), the import dialog led me to believe there was no way to specify times.  Based on your response, I see that selecting just the times (no date part), and choosing DATE(DMY) imports the time in a usable form.  Not very intuitive...

Then the Format>Cells... *does* have Time, 13:37:46 which reinforced my understanding of what was needed...  

The UI makes assumptions I interpreted differently...  :/

Maybe the import dialog should read:   [Date (DMY)] [Time (HMS)]
Comment 4 m_a_riosv 2022-10-21 00:02:30 UTC
Created attachment 183180 [details]
Screenshot with time in their own column

With time alone in a column, it just works fine for me (detecting special numbers active).

I can see a bug.