I created a ValueAccessor that utilizes the PropertyValueReader. When the mapping happens for my C# DateTime to my Sitecore DateTime, the raw value is correct in Sitecore but the form field in content editor provides the equivalent of the minimum value for the Date.

Using the ISO Date Value Reader makes the raw field null along with the field in content editor.

Is there a specific reader and writer to use for DateTime mapping in the Data Exchange Framework?

Update: Question was answered below but a potential date issue has been questioned in the comments. Here is the detailed information around the scenario I am doing.

enter image description here

The dates originate from these json fields. I am doing a JsonConvert.DeserializeObject on the json. I get the following for the dates in the POCO:

Created Date Created Date

Updated Date Updated Date

The Value Mappings are as follows:

enter image description here Created Date

enter image description here Updated Date

I've left the created date alone and added the ISO date reader to the updated date.

After the pipeline runs, here are the CE views of the created item: enter image description here

enter image description here Raw View

  • When you "the raw value is correct", do you mean the raw value is in the correct format for an ISO date? Can you provide the raw value?
    – Adam Conn
    Oct 11, 2016 at 23:58
  • It was in the correct format for an ISO Date as a raw value but did not populate the drop downs for the date controls themselves when not in raw view.
    – mservais
    Oct 12, 2016 at 2:29
  • Hm... that doesn't sound right. Can you post the value so I can try to figure out what's going on?
    – Adam Conn
    Oct 12, 2016 at 2:44
  • Updating the ticket with the actual scenario, for the issue around the date. let me know if it makes more sense @AdamConn to submit a support ticket or even carve out time for a quick video conference call if interested. You did essentially answer my question of reader/writer below so marking this as answered.
    – mservais
    Oct 12, 2016 at 13:33
  • Exactly as I expected :-) You should expect to see 20130613T015444Z as the raw value, not 6/12/2013 6:54:44 PM.
    – Adam Conn
    Oct 12, 2016 at 16:07

1 Answer 1


Explanation of what is happening

The PropertyValueReader simply reads the value of a property. Unless the property you are reading is already formatted as an ISO date, you cannot set that value on a Sitecore date field and expect that Sitecore will recognize the date. You must convert the value read from the property into an ISO date. When you write "the raw value is correct", this is what I assume you are seeing.

One solution

The IsoDateValueReader will convert a DateTime object into an ISO date. If you are using the IsoDateValueReader and you are not getting a value in the field, it is probably because the value you are reading is not a DateTime object.

You can configure the value mapping so it converts the value into an ISO date. This can be handled using the field Transformer for source value.

This field lets you specify a reader that takes the value from the source object and transforms it into a new value. This new value is then passed to the writer so it can be written to the target object.

If you are certain the value you are reading from the source object is a DateTime object, select the reader Value Readers/Common/ISO Date Value Reader for the transformer.

Another solution

An alternative approach is to make sure the date is in the proper format when it is read from the source object. This can be accomplished by creating a custom value reader using the SequentialValueReader type. This type allows you to chain multiple value readers together, where a value reader uses the value read from the previous value reader.

So you could do the following. Imagine the value read from the source object is a DateTime object.

  1. DateTimeValueReader reads the DateTime object
  2. IsoDateValueReader read the DateTime object and converts it to a string

In the particular case described in the question, I think this is overkill. This solution makes sense when the value you read from the source object is not already in a format that can easily be used within a mapping process. If you are reading a DateTime already, that is a format that can easily be used.

What's an example of a value that cannot easily be used? One example is a date read from an external system as a string. In the US, 10/11/2016 means 11 October 2016. In other parts of the world, it means 10 November 2016. Converting the string to a DateTime when you read the value from the external system allows you to avoid this kind of confusion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.