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


     '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:


"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!

  • 2
    No worries about "abusing" – this site is in beta and needs all the questions it can get, and this is a legitimate one. There seems to be some issues with how the plugin's settings model retrieves DateTime objects from the database – see this thread for a workaround. Commented Apr 7, 2015 at 7:52
  • Well, I feel slightly better now, I did read through the post you linked to prior to posting my question and I thought to myself - surely this isn't what I need - it's got to be something I'm doing. At least I'm going down the right path(s) I suppose. Do you think it's "bug worthy" to bring up to the folks at Pixel and Tonic? Thank you again!
    – Damon
    Commented Apr 7, 2015 at 12:10
  • I already sent Brad Bell a DM on Twitter asking him to check out the original thread, so hopefully he'll be able to shed some light on the matter :) Commented Apr 7, 2015 at 12:20

1 Answer 1


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.


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.