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.
- DateTimeValueReader reads the DateTime object
- 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.