qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
17.64k stars 1.69k forks source link

duration has -1 second #1870

Closed vendelin8 closed 3 months ago

vendelin8 commented 3 months ago

Description I tried to set duration for whole hours and minutes, and sometimes I got one second less

Steps to reproduce the issue:

  1. save code from https://go.dev/play/p/iKcHwD__7R5
  2. run locally
  3. open Book1.xlsx with LibreOffice

Describe the results you received: A1 contains 22:59:59

Describe the results you expected: A1 contains 23:00:00 Not all of the durations work like this though, so it's probably a float rounding error, I guess.

Output of go version:

go version go1.22.1 linux/amd64

Excelize version or commit ID:

v2.8.1

Environment details (OS, Microsoft Excel™ version, physical, etc.): Arch Linux, LibreOffice Calc: Version: 24.2.1.2 (X86_64) / LibreOffice Community Build ID: 420(Build:2) CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: hu-HU (hu_HU.UTF-8); UI: en-US 24.2.1-5 Calc: threaded

xuri commented 3 months ago

Thanks for your issue. I have tested with the following spreadsheet applications:

Application Value of A1 Cell
Microsoft® Excel for Mac 16.82 (24021116) 23:00:00
Kingsoft WPS Office for Mac 5.6.0 (8082) 23:00:00
Apache OpenOffice® 4.1.15 Darwin x86_64 23:00:00
LibreOffice 7.5.4.2 22:59:59
Apple Numbers 13.2 (7038.0.87) 22:59:59

I think there are some compatibility issues in the Apple Numbers and LibreOffice.

vendelin8 commented 3 months ago

I searched for it, it's a known issue in LibreOffice. Thanks. For the package and the testing too.