JSON dates not in ISO format anymore

Hi,

In my Configure.AppHost.cs I have set JSON to use ISO dates like this:

public class AppHost : AppHostBase, IHostingStartup
{
// ...
public override void Configure(Container container)
{
        JsConfig.Init(new Config
        {
            DateHandler = DateHandler.ISO8601,
            AlwaysUseUtc = false,
            TextCase = TextCase.CamelCase,
            ExcludeDefaultValues = false,        // e.g. IsStartupItem=false won't be emitted unless ==true
            IncludeNullValues = false
        });
}

However, after the latest builds, using NET8 and SS8, I noticed that dates are not in that format anymore.

This is output direct from the /ui calling a service:

"startDate": "/Date(1519858800000-0000)/",

Here’s from a previous deployment:

"startDate": "2018-03-01T00:00:00.0000000",

I have the binaries for both. Just compiled a fresh build and put on the server that workd (with ISO format) and now it has the “bad” format, so it’s not the server. It has NET8 and works, so it’s something with the code build. I can compare versions of SS DLL’s, if there are any specific I should check.

This causes the users of my API to crash.

It might be overridden, can you try adding it to Config.TextConfig, e.g:

SetConfig(new HostConfig {
    TextConfig = new Config
    {
        DateHandler = DateHandler.ISO8601,
        AlwaysUseUtc = false,
        TextCase = TextCase.CamelCase,
        ExcludeDefaultValues = false,        // e.g. IsStartupItem=false won't be emitted unless ==true
        IncludeNullValues = false
    }
});
1 Like

Seems to have fixed it.

So I won’t need both JsConfig and TextConfig, correct?

I’ll look at rolling back changes to Config.TextConfig since I want existing JsConfig.Init() configuration to continue working, I’ll let you know when it’s updated.

I’ve ended reverting Config.TextConfig, so if you update to the latest v8.0.1 in pre-release packages then your previous JsConfig.Init() configuration should work.

1 Like