<p>Solved. Presumably this was a bug. An update just hit for Craft CMS 3.7.9 which states in the release notes &quot;Fixed a bug where Date fields weren’t handling array values with datetime keys properly. (#9708)&quot;.</p>
<p>Code now works as expected.</p>

CC BY-SA 4.0
2021-08-19T15:48:33.687Z
2021-08-19T15:48:33.687Z
Mosswalker
<p>Following the example in the documentation, this code:</p>
<pre><code>&lt;input type=&quot;datetime-local&quot; name=&quot;fields[startDate][datetime]&quot; value=&quot;{{ currentValue }}&quot;&gt;

&lt;select name=&quot;fields[startDate][timezone]&quot;&gt;
    &lt;option value=&quot;UTC&quot; selected&gt;UTC&lt;/option&gt;
    &lt;option value=&quot;America/Los_Angeles&quot;&gt;Pacific Time&lt;/option&gt;
    &lt;!-- ... --&gt;
&lt;/select&gt;
</code></pre>
<p>Does not work for me. Nothing is saved. The form is otherwise working.</p>
<p><strong>If I simplify to this, it saves: (note that I've removed [datetime] as well as the timezone)</strong></p>
<pre><code>&lt;input type=&quot;datetime-local&quot; name=&quot;fields[startDate]&quot; value=&quot;{{ currentValue }}&quot;&gt;
</code></pre>
<p><strong>This also does not save:</strong></p>
<pre><code>&lt;input type=&quot;datetime-local&quot; name=&quot;fields[startDate][datetime]&quot; value=&quot;{{ currentValue }}&quot;&gt;
</code></pre>
<p><strong>If I include a hidden field for timezone, it saves:</strong></p>
<pre><code>&lt;input type=&quot;datetime-local&quot; name=&quot;fields[startDate][datetime]&quot; value=&quot;{{currentValue}}&quot;&gt;
{{ hiddenInput('fields[startDate][timezone]', tz) }}
</code></pre>

CC BY-SA 4.0
2021-08-18T17:35:57.480Z
Where is this being posted - to an entry? Looks like you're using [this](https://craftcms.com/docs/3.x/time-fields.html#working-with-time-field-data) example?
RitterKnight
CC BY-SA 4.0
2021-08-19T08:24:08.653Z
Is the `startDate` field set to **Show date and time** and has the option **Show Time Zone** active? Otherwise, the timezone is ignored. Also, how are you checking if the timezone is saved or not? What is your expected result in your example and what are you seeing instead?
MoritzLost
CC BY-SA 4.0
2021-08-19T14:45:08.423Z
Thanks for the questions. Yes, the field is set with the "show date and time" and "show time zone options." I'm checking the data, including the timezone, in the control panel. When I am saying it does not save, I mean that the field is empty after saving-- both the date/time and the timezone.
Mosswalker
CC BY-SA 4.0
2021-08-19T15:14:09.690Z
@RitterKnight No, I'm using [this](https://craftcms.com/docs/3.x/date-time-fields.html#customizing-the-timezone) example from the DATE field. It is being saved to an entry.
Mosswalker
CC BY-SA 4.0
2021-08-19T17:19:19.107Z
Voting to close this because it was a bug.
RitterKnight
<timezone>
Letting front-end user set time zone
# Letting front-end user set time zone

(Asked by: username_0 on 2021-08-18)

Following the example in the documentation, this code:



    UTC
    Pacific Time
    


Does not work for me. Nothing is saved. The form is otherwise working.
If I simplify to this, it saves: (note that I've removed [datetime] as well as the timezone)


This also does not save:


If I include a hidden field for timezone, it saves:

{{ hiddenInput('fields[startDate][timezone]', tz) }}

**Tags:** timezone
> **Comments:**
> **username_1**: Where is this being posted - to an entry? Looks like you're using [this](https://craftcms.com/docs/3.x/time-fields.html#working-with-time-field-data) example?  
> **username_2**: Is the `startDate` field set to **Show date and time** and has the option **Show Time Zone** active? Otherwise, the timezone is ignored. Also, how are you checking if the timezone is saved or not? What is your expected result in your example and what are you seeing instead?  
> **username_0**: Thanks for the questions. Yes, the field is set with the "show date and time" and "show time zone options." I'm checking the data, including the timezone, in the control panel. When I am saying it does not save, I mean that the field is empty after saving-- both the date/time and the timezone.  
> **username_0**: @RitterKnight No, I'm using [this](https://craftcms.com/docs/3.x/date-time-fields.html#customizing-the-timezone) example from the DATE field. It is being saved to an entry.  
> **username_1**: Voting to close this because it was a bug.  

---

## 1 answers

### Answer by username_0 on 2021-08-19. Score: 1

Solved. Presumably this was a bug. An update just hit for Craft CMS 3.7.9 which states in the release notes "Fixed a bug where Date fields weren’t handling array values with datetime keys properly. (#9708)".

Code now works as expected.


---

