DateTime.MinValue not serialised using JSON

Using SS 5.4.1 I I have the following config in my AppHost:

        JsConfig<DateTime>.SerializeFn = time => new DateTime(time.Ticks, DateTimeKind.Local).ToString("o");
        JsConfig<DateTime?>.SerializeFn =
            time => time != null ? new DateTime(time.Value.Ticks, DateTimeKind.Local).ToString("o") : null;
        JsConfig.DateHandler = DateHandler.ISO8601;

When the value to output is a DateTime.MinValue the field is suppressed and not serialised. Is there a way to force DateTime.MinValue to be seralised usng JSON. They do get seralised correctly using SOAP.

TIA

Nic

You can include default values from being omitted with:

JsConfig.ExcludeDefaultValues = false;

I had already tried that and it made / makes no difference - I still don’t see the DateTime.MinValue fields in the JSON.

Nic

Overriding custom date handling caused the default value from being suppressed.

I’m looking into seeing why this is the behaviour.

Ok if you’re overriding serialization you need to specify that you want the default value included with:

JsConfig<DateTime>.IncludeDefaultValue = true;

Ah - I just had not spotted that option. Works perfectly.

Thanks again

Nic