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:
parent
5542b1ac56
commit
0aeefd619f
@ -42,11 +42,15 @@ begin
|
|||||||
WriteLn('Contents of the first worksheet of the file:');
|
WriteLn('Contents of the first worksheet of the file:');
|
||||||
WriteLn('');
|
WriteLn('');
|
||||||
|
|
||||||
|
WriteLn('****', EncodeDate(1908,12,09) + EncodeTime(12,0,0,0));
|
||||||
|
|
||||||
cell := MyWorkSheet.GetFirstCell();
|
cell := MyWorkSheet.GetFirstCell();
|
||||||
for i := 0 to MyWorksheet.GetCellCount - 1 do begin
|
for i := 0 to MyWorksheet.GetCellCount - 1 do begin
|
||||||
WriteLn('Row: ', cell^.Row,
|
WriteLn('Row: ', cell^.Row,
|
||||||
' Col: ', cell^.Col, ' Value: ',
|
' Col: ', cell^.Col, ' Value: ',
|
||||||
UTF8ToAnsi(MyWorkSheet.ReadAsUTF8Text(cell^.Row, cell^.Col))
|
UTF8ToAnsi(MyWorkSheet.ReadAsUTF8Text(cell^.Row, cell^.Col))
|
||||||
|
, ' NumberValue:', FloatToStr(cell^.NumberValue)
|
||||||
|
, ' DateTimeValue: ', FloatToStr(cell^.DateTimeValue)
|
||||||
);
|
);
|
||||||
cell := MyWorkSheet.GetNextCell();
|
cell := MyWorkSheet.GetNextCell();
|
||||||
end;
|
end;
|
||||||
|
@ -495,6 +495,17 @@ begin
|
|||||||
if (FoundPos > 1) then
|
if (FoundPos > 1) then
|
||||||
Value := Copy(Value, 1, FoundPos-1);
|
Value := Copy(Value, 1, FoundPos-1);
|
||||||
Result := StrToDateTime(Value, Fmt);
|
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
|
end else begin
|
||||||
// Try time only, e.g. PT23H59M59S
|
// Try time only, e.g. PT23H59M59S
|
||||||
// 12345678901
|
// 12345678901
|
||||||
|
Loading…
Reference in New Issue
Block a user