diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e0678df01c..54940c023e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,10 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-24 02:21 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + * harbour/rtl/hbjson.c + + added support for date and timestamp type encoding + 2010-10-24 02:10 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/rtl/hbjson.c + added human readable JSON encoding support diff --git a/harbour/src/rtl/hbjson.c b/harbour/src/rtl/hbjson.c index 795ff0a2aa..5fad3e9db7 100644 --- a/harbour/src/rtl/hbjson.c +++ b/harbour/src/rtl/hbjson.c @@ -262,6 +262,23 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, HB_SIZE n _hb_jsonCtxAdd( pCtx, "false", 5 ); } + else if( HB_IS_DATE( pValue ) ) + { + char szBuffer[ 10 ]; + + hb_itemGetDS( pValue, szBuffer + 1 ); + szBuffer[ 0 ] = '\"'; + szBuffer[ 9 ] = '\"'; + _hb_jsonCtxAdd( pCtx, szBuffer, 10 ); + } + else if( HB_IS_TIMESTAMP( pValue ) ) + { + char szBuffer[ 19 ]; + hb_itemGetTS( pValue, szBuffer + 1 ); + szBuffer[ 0 ] = '\"'; + szBuffer[ 18 ] = '\"'; + _hb_jsonCtxAdd( pCtx, szBuffer, 19 ); + } else if( HB_IS_ARRAY( pValue ) ) { HB_SIZE nLen = hb_itemSize( pValue );