Date & Time Values and Offsets
The Date Picker, Date Time Picker, and Time Picker controls have the capability to output an ISO 8601 string value which is converted to a DateTime or DateTimeOffset object in a workflow (depending on the type of the workflow argument).
Example
Assume one is using a control on March 8 at 10AM in Florida during Eastern Standard Time:
-
Date Picker
The Date Picker control should have Ignore Time set to
true
and will only output the date portion of the ISO 8601 string.vm.models output example: “2018-03-08” DateTime object will show: Mar 8, 2018 at midnight, no offset DateTimeOffset: same and likewise no offset -
Date Time Picker
vm.models output example: “2018-03-08T10:00:00.000-05:00” DateTime object will show: Mar 8, 2018 10 AM, offset is lost DateTimeOffset: same but will have Offset property set to 5 hours -
Time Picker
vm.models output example: 2018-03-08T10:00:00.000-05:00” DateTime object will show: same as Date Time Picker, but typically you will ignore the date and use only a formatted String as the time DateTimeOffset: same but will have Offset property set to 5 hours
When binding vm.models values for these controls directly to an entity argument property, if the associated database Datetime
column is not nullable, the entity data type is DateTime
instead of Nullable<DateTime>
. This means a direct model map to an entity argument property must have Required set to true
so that client-side validation will prevent submittal of a value if it is null (no value). Failure to do so would cause an error in the workflow and a subsequent abort of the workflow.
If the entity property is Nullable<DateTime>
, you still might not want to store a null value in certain circumstances (since it might be invalid for the situation). In that case you could mark it required in the client, or conditionally in the workflow, check your argument with the property myDate.HasValue
and create a descriptive server validation error if it is false.