diff options
author | joost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-06-13 12:24:16 +0000 |
---|---|---|
committer | joost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-06-13 12:24:16 +0000 |
commit | 1022fb257ee52ac94fe05b82fa5ec7b26940554d (patch) | |
tree | 55f66060d01a57fb292aaf9c154e41036e26bfca | |
parent | 1455d85f32f445f7cf2576028c0e1972b67a4b7c (diff) | |
download | fpc-1022fb257ee52ac94fe05b82fa5ec7b26940554d.tar.gz |
* If a variant contains a datetime value and is converted to a string, it should return a string in a date/time format. (+test)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@7643 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | rtl/objpas/cvarutil.inc | 4 | ||||
-rwxr-xr-x | tests/tbs/tb0536.pp | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/rtl/objpas/cvarutil.inc b/rtl/objpas/cvarutil.inc index d3e518887f..926c72262b 100644 --- a/rtl/objpas/cvarutil.inc +++ b/rtl/objpas/cvarutil.inc @@ -1180,7 +1180,7 @@ begin varSingle : Result := FloatToStr(vSingle); varDouble : Result := FloatToStr(vDouble); varCurrency : Result := FloatToStr(vCurrency); - varDate : Result := FloatToStr(vDate); + varDate : Result := DateToStr(vDate); varBoolean : Result := BoolToStr(vBoolean, True); varVariant : Result := VariantToAnsiString(PVarData(vPointer)^); varByte : Result := IntToStr(vByte); @@ -1200,7 +1200,7 @@ begin varSingle : Result := FloatToStr(PSingle(vPointer)^); varDouble : Result := FloatToStr(PDouble(vPointer)^); varCurrency : Result := FloatToStr(PCurrency(vPointer)^); - varDate : Result := FloatToStr(PDate(vPointer)^); + varDate : Result := DateToStr(PDate(vPointer)^); varBoolean : Result := BoolToStr(PWordBool(vPointer)^, True); varVariant : Result := VariantToAnsiString(PVarData(vPointer)^); varByte : Result := IntToStr(PByte(vPointer)^); diff --git a/tests/tbs/tb0536.pp b/tests/tbs/tb0536.pp new file mode 100755 index 0000000000..3afa58f97c --- /dev/null +++ b/tests/tbs/tb0536.pp @@ -0,0 +1,15 @@ +program TestDateVariantConversion; + +uses variants; + +var dt : TDateTime; + v : variant; + s : String; + +begin + dt := 40000; + v := dt; + s := v; + // It should return the date, depending on the localisation settings + if s = '40000' then halt(1); +end. |