I have tried searching informations on net.core documentation (issue etc) without results. The code is simpler:
[HttpGet()]
[Route("dob")]
public string dobTest()
{
var content = @"""1942-01-01T22:00:00.000Z""";
var settings = new JsonSerializerSettings()
{
//DateFormatHandling = DateFormatHandling.IsoDateFormat,
//DateParseHandling = DateParseHandling.DateTimeOffset,
DateTimeZoneHandling = DateTimeZoneHandling.Local,
//DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind
};
var dob = JsonConvert.DeserializeObject<DateTime>(content, settings);
return $"dob: {dob.ToString("yyyy-MM-dd HH:mm:ss.fff")} - {dob.Kind}";
}
if I run this code on Mac or Linux the result is:
dob: 1942-01-02 00:00:00.000 - Local
if I run this code on windows the result is:
dob: 1942-01-01 23:00:00.000 - Local
My MacOs timezone is set on Rome(UTC +01:00) Windows timezone is set on Rome(UTC +01:00)
the version of Newtonsoft.Json is 12.0.3 The version of net framework is net core 3.1