Repopulate dateTime field in plugin settings page In my plugin settings page, I have a startDate input which is a dateTime field.

_settings.html

{{
    forms.dateField({
     'label': 'Start Date'|t,
     'instructions': 'Choose a date'|t,
     'id': 'myStartDate',
     'name': 'myStartDate',
     'placeholder': 'mm/dd/yyyy',
     'value': settings.myStartDate,
     'errors': settings.getErrors('myStartDate')
    })
}}


My data is getting saved correctly - I can see it:

json

  ....
"myStartDate": {
    "date": "2015-04-13 05:00:00
}
  ....


So I thought cool. I just need: myStartDate.date and all is well. No luck.

What is curious to me, is when I fill out my start date, but my form fails validation, the date that I have entered is correctly repopulated. I don't have to re-enter the date.

But, once I successfully submit my settings, and then come back, my date field is no longer populated.

I've tried myStartDate and myStartDate.date and myStartDate|date("m/d/Y") but all with no luck.

I feel like I'm abusing this community with so many questions lately. I know the dateTime field needs to be a dateTime object - and I assume that's why it's not working for me. I'm not passing it what it needs.

Thank you for your time!
Long story short, this is a bug in Craft 2.x that's already been fixed in the Craft 3.x branch.

Considering there is a workaround for 2.x and the proper fix would be pretty ugly in 2, we're just going to let this one die a slow death with the release of Craft 3.