You've already forked lazarus-ccr
fpspreadsheet: Fix remaining issue of ods-1904 datetests. All tests green finally again.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3139 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -42,11 +42,15 @@ begin
|
||||
WriteLn('Contents of the first worksheet of the file:');
|
||||
WriteLn('');
|
||||
|
||||
WriteLn('****', EncodeDate(1908,12,09) + EncodeTime(12,0,0,0));
|
||||
|
||||
cell := MyWorkSheet.GetFirstCell();
|
||||
for i := 0 to MyWorksheet.GetCellCount - 1 do begin
|
||||
WriteLn('Row: ', cell^.Row,
|
||||
' Col: ', cell^.Col, ' Value: ',
|
||||
UTF8ToAnsi(MyWorkSheet.ReadAsUTF8Text(cell^.Row, cell^.Col))
|
||||
, ' NumberValue:', FloatToStr(cell^.NumberValue)
|
||||
, ' DateTimeValue: ', FloatToStr(cell^.DateTimeValue)
|
||||
);
|
||||
cell := MyWorkSheet.GetNextCell();
|
||||
end;
|
||||
|
@ -495,6 +495,17 @@ begin
|
||||
if (FoundPos > 1) then
|
||||
Value := Copy(Value, 1, FoundPos-1);
|
||||
Result := StrToDateTime(Value, Fmt);
|
||||
|
||||
// If the date/time is within 1 day of the base date the value is most
|
||||
// probably a time-only value (< 1).
|
||||
// We need to subtract the datemode offset, otherwise the date/time value
|
||||
// would not be < 1 for fpc.
|
||||
case FDateMode of
|
||||
dm1899: if Result - DATEMODE_1899_BASE < 1 then Result := Result - DATEMODE_1899_BASE;
|
||||
dm1900: if Result - DATEMODE_1900_BASE < 1 then Result := Result - DATEMODE_1900_BASE;
|
||||
dm1904: if Result - DATEMODE_1904_BASE < 1 then Result := Result - DATEMODE_1904_BASE;
|
||||
end;
|
||||
|
||||
end else begin
|
||||
// Try time only, e.g. PT23H59M59S
|
||||
// 12345678901
|
||||
|
Reference in New Issue
Block a user