Body: <p>I want to use the built-in Craft field macros to show a date field in a plugin template for filtering. </p>
  
  <p>I can retrieve the submitted value on any submission (via GET) but how do I then prepopulate said date field with the previously submitted value? 
  When I try to simply pass the submission into the value property I get an <code>Array to string conversion</code> error. </p>
  
  <p>My plugin template code …</p>
  
  <pre><code>{% set start = craft.request.getParam('start') %}    
  {{ dump(start) }}
  {{ forms.dateField({
      label: 'Start date',
      id: 'start',
      name: 'start',
      value: start }) }}
  </code></pre>
  
  <p>So my question is; is there anyway I can pass a value into the dateField that has been submitted via a POST or GET variable?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-08T13:34:50.253Z
Comments.Text: It might be helpful to show us your `start` variable
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-08T21:24:19.630Z
Comments.Text: What does `{{ dump(start) }}` output?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T15:46:05.103Z
Comments.Text: @RobinSchambach if I pass the value posted from the dateField element then I get  'date' => string '08/11/2017' (length=10) (where the above code example generates an input field with a name of `start[date]`).
Comments.UserDisplayName: Cole Henley
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T15:46:36.293Z
Comments.Text: @BradBell this outputs:
  
      `array (size=1)`
      `'date' => string '08/11/2017' (length=10)`
Comments.UserDisplayName: Cole Henley
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T15:49:53.613Z
Comments.Text: If i try to pass my date string as a value into {{ forms.dateField }} I get following error:
  
  `Impossible to invoke a method ("localeDate") on a string variable ("11-08-2017")`
Comments.UserDisplayName: Cole Henley
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T15:58:15.043Z
Comments.Text: Thanks both - had overseen suggestion on Slack for following which works:
  
  `value: now|date_modify(start.date)`
Comments.UserDisplayName: Cole Henley
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T16:17:35.007Z
Comments.Text: Hmmm, perhaps spoke to soon. 
  
  Bizarrely when using the datefield it outputs dates in the following format DD-MM-YYYY. However, when I capture this value and try to output it in my template it is assuming that the DD is MM and MM is DD.
  
  So for example, with a value of 12 November it posts `11-12-2017` as the GET value but in my template it is assuming this is 11 December.
  
  Any further thoughts? Obviously some kind of mix-up with localisation but seems strange that the datefield is outputting in one kind and then the template is interpreting this value in a different way.
  
  Thoughts?
Comments.UserDisplayName: Cole Henley
Tags: <plugin-development><localization><datetime>
Title: Updating `{{ forms.dateField }}` value from GET variable
ThreadText: # Updating `{{ forms.dateField }}` value from GET variable
  
  (Asked by: username_0 on 2017-11-08)
  
  I want to use the built-in Craft field macros to show a date field in a plugin template for filtering.
  
  I can retrieve the submitted value on any submission (via GET) but how do I then prepopulate said date field with the previously submitted value?
  When I try to simply pass the submission into the value property I get an `Array to string conversion` error.
  
  My plugin template code …
  
  ```
  {% set start = craft.request.getParam('start') %}    
  {{ dump(start) }}
  {{ forms.dateField({
      label: 'Start date',
      id: 'start',
      name: 'start',
      value: start }) }}
  
  ```
  
  So my question is; is there anyway I can pass a value into the dateField that has been submitted via a POST or GET variable?
  
  **Tags:** plugin-development, localization, datetime
  
  > **Comments:**
  > **username_1**: It might be helpful to show us your `start` variable  
  > **username_2**: What does `{{ dump(start) }}` output?  
  > **username_0**: @username_1 if I pass the value posted from the dateField element then I get  'date' => string '08/11/2017' (length=10) (where the above code example generates an input field with a name of `start[date]`).  
  > **username_0**: @username_2 this outputs:      `array (size=1)`     `'date' => string '08/11/2017' (length=10)`  
  > **username_0**: If i try to pass my date string as a value into {{ forms.dateField }} I get following error:  `Impossible to invoke a method ("localeDate") on a string variable ("11-08-2017")`  
  > **username_0**: Thanks both - had overseen suggestion on Slack for following which works:  `value: now|date_modify(start.date)`  
  > **username_0**: Hmmm, perhaps spoke to soon.   Bizarrely when using the datefield it outputs dates in the following format DD-MM-YYYY. However, when I capture this value and try to output it in my template it is assuming that the DD is MM and MM is DD.  So for example, with a value of 12 November it posts `11-12-2017` as the GET value but in my template it is assuming this is 11 December.  Any further thoughts? Obviously some kind of mix-up with localisation but seems strange that the datefield is outputting in one kind and then the template is interpreting this value in a different way.  Thoughts?  
  
  ---
  
  ## 0 answers
  
  