migueldeicaza / MonoTouch.Dialog

Tools to simplify creating dialogs with the user using MonoTouch
MIT License
430 stars 211 forks source link

Fix bug 26938 Can't create DateTimePicker element from JSON string #235

Closed dalexsoto closed 8 years ago

dalexsoto commented 8 years ago

Exception is thrown in MonoTouch.Dialog.DateTimeElement.CreatePicker() method because DateTime instance can't be converted to NSDate if DateTime.Kind is not specified. Side effect of not allowing an implicit DateTime/NSDateTime conversions.

This Allows users to specify DateTimeKind explicitly from JSON, or via a static property DateKind from JsonElement and if that is not specified we just default to DateTime.Kind to be local.

Example:

"header": "Dates and Times",
"elements": [
    {
    "type": "date",
    "caption": "Date",
    "value": "10/10",
    "kind": "local"
    }
]

kind accepted values:

rolfbjarne commented 8 years ago

:+1:

spouliot commented 8 years ago

LGTM too, @dalexsoto please merge and bump