Datetime with null value is returned with default datetime in Squidex.ClientLibrary (Nuget C#)

I have…

  • [ ] Checked the logs and have provided the logs if I found something suspicious there

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Steps:

  1. Declare DateTime type (in schema)

    [JsonConverter(typeof(InvariantConverter))]
    public DateTime Birthdate { get; set; }

  2. Create schema content with Birthdate set to null (optional).

  3. Request get content, working fine as Birthdate is absent in the response body.

  4. Using Squidex Client Library (Nuget C#). The Birthdate is returned with a default Datetime 0001-01-01T00:00:00+00:00

Expected behavior

Datetime with null value should not be assigned to default Datetime anyway.

Version: 4.2.0

It’s not Squidex, it’s about Datetime default to 01/01/00 in Mvc.
Closing.

You can declare your property as DateTime? or Nullable<DateTime>

1 Like