Custom serialization format seems not work for null DateTime

In my AppHost I configure a custom format for datetime serialization as follow:

JsConfig.SerializeFn= dateTime =>
(dateTime == null ? “” : dateTime.ToUniversalTime().ToString(“yyyy-MM-dd HH:mm:ss”, CultureInfo.InvariantCulture));

When the POCO declares a DateTime field this is always serialized as expected.

When the POCO declares a nullable date time field (DateTime?) the configuration is ignored, for field filled with valid date time the json shows “/Date(nnnnnnnnnnn-nnnn)/” instead of “yyyy-MM-dd HH:mm:ss” whilst for null date time it correctly reports null.

What I’am omitting?

You need to define the serializer for DateTime? Type as well.

Wonderful, not it works as I need.

Great mythz.

Thanks a lot.