#1 2019-02-11 08:40:08

chapa
Member
Registered: 2012-04-30
Posts: 117

DateToIso8601PChar when year is not 4 digit

Hi ab,

Recently debugging why I am producing invalid JSON content led me to following:

using ObjectToJson and more precisely
procedure DateToIso8601PChar(P: PUTF8Char; Expanded: boolean; Y,M,D: cardinal);
expects the year to be 4 digits, reasonably right expectation.

But in practice, I am transferring objects, containing TDateTime, which are filled/generated based on public data, and there is no guarantee that the year will be correct parsed/provided.
I got some 50895 year, if I remember well, than #0 in the json content.

As I believe we will use mORMot even after 9999 year, so I gladly ask for a fix big_smile

P.S.
I still generate invalid UTF8 when streaming data, will further investigate.

Offline

#2 2019-02-11 09:49:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: DateToIso8601PChar when year is not 4 digit

I don't exactly get the problem. Could you post some code to show what you expect?

If you want to validate the date before serialization, it is up to your business/logic layer, not at framework level, I guess.

Offline

Board footer

Powered by FluxBB