Code Component Editor: Add a Date and DateTime prop type
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3566541. -->
Reported by: [effulgentsia](https://www.drupal.org/user/78040)
Related to !513
>>>
<h3 id="overview">Overview</h3>
<p>SDC's allow props with schema: <code>type: string, format: date</code> or <code>type: string, format: date-time</code>, but neither of these are currently included in the Type drop-down when defining props in the Code Component Editor.</p>
<p>It would be good to allow Code Components to receive date props, which would enable a content editor to populate it statically with a calendar widget or dynamically by linking to a date field that's on the node.</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<ul>
<li>Add a Date option in the Type drop-down.</li>
<li>Possibly also add a "Date and time" option, or include that as a separate checkbox for the Date option, or punt on date-time to a follow-up if we want to think more about whether to make it a separate top-level type choice or a sub-choice of Date.</li>
</ul>
<h3 id="ui-changes">User interface changes</h3>
<p>New option(s) added to the Type drop-down.</p>
<dl>
<dt>Before</dt>
<dd><img src="https://www.drupal.org/files/issues/2026-01-09/Screenshot%202026-01-09%20at%209.39.58%E2%80%AFAM.png"></dd>
<dt>After</dt>
<dd><img src="https://www.drupal.org/files/Screenshot%202026-02-11%20at%203.07.56%E2%80%AFPM.png" alt="date"><br>
<img src="https://www.drupal.org/files/Screenshot%202026-02-11%20at%203.08.03%E2%80%AFPM.png" alt="type"><br>
<img src="https://www.drupal.org/files/issues/2026-02-11/Screenshot_2026-02-03_at_5.34.43_PM.png" alt="date">
</dd>
</dl>
> Related issue: [Issue #3563380](https://www.drupal.org/node/3563380)
> Related issue: [Issue #3498889](https://www.drupal.org/node/3498889)
> Related issue: [Issue #3572934](https://www.drupal.org/node/3572934)
> Related issue: [Issue #3573426](https://www.drupal.org/node/3573426)
issue