Time '0:00' is not saved correctly after loading and saving a file
Created originally on Bitbucket by rgeens (Raf Geens)
Midnight seems to produce a strange result when loaded and saved through openpyxl. Other times did not seem affected.
Steps to reproduce:
- In Excel, format a cell as Time with an English (US) locale. Put a 0 value in it.
- It will display as '0:00' and the cell contents will show as '00:00:00'.
- Format another cell as Custom with the 'hh:mm' format. Put a 0 value in it.
- It will display as '00:00' and the cell contents will show as '00:00:00'.
- Save the file as time_example.xlsx (see attachment)
- Load and save the file in openpyxl:
import openpyxl
wb = openpyxl.load_workbook('time_example.xlsx')
wb.save('test.xlsx')
- 7a. Open test.xlsx in Excel. Both cells will display as hash signs and the contents will be -1.
- 7b. Open test.xlsx in LibreOffice. Both cells will display as normal (besides the custom field showing as 0:00 instead of 00:00), but the contents will be '-24:00:00'.
- 7c. Open test.xlsx in Google Spreadsheets. Both cells will display as normal (besides the custom field showing as 0:00 instead of 00:00), but the contents will be '29/12/1899 00:00:00'
Versions:
- openpyxl: 2.5.3
- Python: 3.5.5
- Excel: 2016, Version 1803
- LibreOffice: 5.4.6.2
Attachments: excelgooglesheetslibreofficetime_example.xlsx