U4-10944 - Date Picker in Nested Content does not save value

Created by Joanna Zhang 07 Feb 2018, 18:10:46 Updated by Heather L Floyd 18 May 2018, 03:02:49

Relates to: U4-10947

Relates to: U4-11348

Update: A summary of the issue and fix is listed below http://issues.umbraco.org/issue/U4-10944#comment=67-44527

What did you do?

Initially, I hit save on my current Umbraco Cloud project, and realised that the date fields in my nested content have disappeared, when looking at the network log, it seems like the date is not even sent.

I was not too sure if this problem was localised to my Umbraco Cloud project, so I spun up a new Visual Studio project and installed Umbraco via Nuget (7.7.10) and did the same thing. However, the same bug still happened.

I also tested saving a date field that is not in a nested content and that seems to save fine, so it seems to be a problem related to nested content and the date picker itself.

Repro Steps

  1. Create new VS Solution
  2. Install UmbracoCMS package 7.7.10
  3. Install without starter kit
  4. Create document type with DatePicker
  5. Create document type with Nested Content using the doctype created in (4)
  6. Create content with the newly created document type (in (5)) 6a. Add a nested content item 6b. Set the date field to any date 6c. Save & publish
  7. Refresh the page
  8. Observe that the date has not saved and is blank

What did you expect to happen?

The date to be set and saved correctly.

What actually happened?

The date field does not save a value at all.

Impact This is currently causing issues on a production site for us.

4 Attachments


Sebastiaan Janssen 08 Feb 2018, 20:26:23

I can repro, this was not a problem in 7.7.9 but it is now in 7.7.10.

Also: a mandatory numeric field will now not validate correctly, no matter what value I put in there (this is not even in Nested Content, it's a normal property on a doctype).

Sebastiaan Janssen 08 Feb 2018, 20:30:37

Note: the values submitted to UmbracoApi/Content/PostSave are correct.

Shannon Deminick 08 Feb 2018, 23:31:39

The fix for this is the same as this: http://issues.umbraco.org/issue/U4-10947 , see my comments http://issues.umbraco.org/issue/U4-10947#comment=67-44511

Sebastiaan Janssen 09 Feb 2018, 09:55:29

This is indeed fixed in U4-10947.

Sebastiaan Janssen 09 Feb 2018, 10:03:54

To summarize

The problem was caused by us to do type conversions from datatypes to the C# types of:

  • DateTime
  • Long
  • Boolean
  • Decimal

These types are not nullable by default. However, if we were trying to do these conversions multiple times (for example: if you are using Nested Content, it does it's own additional conversion for each value) we would try to convert a DateTime to a nullable DateTime, which fails, leaving us with the resulting valuue of null, which is what was stored in the database.

We have added additional unit tests for when we do future alterations to this code so that we'll know it fails before we release anything.

This also caused the following problems:

http://issues.umbraco.org/issue/U4-10947 http://issues.umbraco.org/issue/U4-10950

Dave Clarke 09 Feb 2018, 10:41:02

@sebastiaan I noticed above you said the values submitted to PostSave were correct, but that wasn't what we were seeing. See http://issues.umbraco.org/_persistent/networklog.png?file=64-6509&v=0&c=true&rw=724&rh=306&u=1518027046782 the date property is an empty string.

Sebastiaan Janssen 09 Feb 2018, 10:45:16

@clarkd I understand, this is probably because:

  1. You save
  2. Everything still looks great (but the model returned to the page now contains a null value)
  3. You save again
  4. The model with the null value is posted instead of what is visually on your page

I'll do a quick test to confirm.

Sebastiaan Janssen 09 Feb 2018, 10:56:51

I can repro and luckily I can report back that the fixes we made actually fix this issue as well. :-)

Thanks for the sanity check @clarkd !

Dave Clarke 09 Feb 2018, 11:30:54

Awesome - thanks @sebastiaan and @Shandem!

Priority: Major

Type: Bug

State: Fixed


Difficulty: Normal

Category: Editor

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.7.10

Due in version: 7.7.11, 7.8.1


Story Points: