Bug 88787 - FILEOPEN: Numbers formatted as dates before AD 1-01-04 corrupted
Summary: FILEOPEN: Numbers formatted as dates before AD 1-01-04 corrupted
Status: CLOSED DUPLICATE of bug 100452
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-25 12:02 UTC by Aaron
Modified: 2017-05-04 16:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Testing spreadsheet (38.48 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-01-25 12:02 UTC, Aaron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron 2015-01-25 12:02:50 UTC
Created attachment 112787 [details]
Testing spreadsheet

See attachment. Column D originally contained the same values as column A (using Paste Only -> Number) and was then formatted with G EE-MM-DD date format before saving.

Steps to reproduce:
1. Enter any number less than -693592.
2. Format using any date format.
3. Save and reopen. The date will show 1899-12-30 (or equivalent) and should have numerical value 0 instead of the entered value.

While testing this bug I also noticed another relating to formatting i.e. column E was formatted as General when saved but reopens as G EE-MM-DD. This will be in a separate report.
Comment 1 raal 2015-01-26 16:19:44 UTC
I can confirm with Version: 4.5.0.0.alpha0+
Build ID: 60143f4f7bc50054dcef923218b8c7c3bc154933
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-01-21_04:58:34
Comment 2 Cor Nouws 2015-02-03 10:02:21 UTC
Hi Aaron, raal,

Was this OK in previous versions?
Comment 3 raal 2015-02-03 18:32:36 UTC
(In reply to Cor Nouws from comment #2)
> Hi Aaron, raal,
> 
> Was this OK in previous versions?

Lo 3.5 has the same problem.
Comment 4 QA Administrators 2016-02-21 08:34:58 UTC Comment hidden (obsolete)
Comment 5 Laurent Balland 2016-06-20 12:15:35 UTC
ISO Dates saved in ODF format cannot have negative year:
http://opengrok.libreoffice.org/xref/core/tools/source/datetime/tdate.cxx#32
So dates BC cannot be saved. This bug should resolved as WONTFIX.

LibO is using a different class css::util::Date to handle calculations with dates. This class enables negative years to have dates BC.

Then an easy workaround comes: use a formula such as:
=-700000
to preserve a date such as June 20th, 18 BC in your ODF file.
Comment 6 Eike Rathke 2017-05-04 16:56:56 UTC
Already fixed with bug 100452 for 5.3

*** This bug has been marked as a duplicate of bug 100452 ***