datetime-picker
Despite the name, datetime-picker is not something you put in a widget= attribute on a form view. It is a website side interaction that upgrades any frontend <input> carrying data-widget="datetime-picker" into Odoo's calendar picker.
| Technical name | datetime-picker |
|---|---|
| Field types | none (attaches to an HTML input, not a record field) |
| Views | website frontend (QWeb templates, portal and survey pages) |
| Also registered as | registered in the public.interactions registry as web.datetime_picker (not in the fields registry) |
| Module | web, active on website frontend pages |
| Used in core | 4 occurrences across 2 modules: survey (activity deadline inputs), website_crm_partner_assign |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0 |
| No-code setup | No. It is wired through HTML data attributes in QWeb templates, not through Studio. |
| Alternatives | datetime, date, daterange |
What the datetime-picker interaction does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
data-widget-type (attribute) | string: date | datetime | HTML data attribute. Chooses date only or date plus time mode; it also selects which parser reads the input's initial value (parseDate vs parseDateTime). Any value other than date falls back to datetime.(default: datetime) |
data-min-date (attribute) | serialized date string | HTML data attribute. Lower bound for selectable dates, deserialized with the server format (YYYY-MM-DD or YYYY-MM-DD HH:mm:ss depending on mode) before being passed to the picker. |
data-max-date (attribute) | serialized date string | HTML data attribute. Upper bound for selectable dates, deserialized the same way as data-min-date. |
These are HTML data attributes on the input element, not view options. data-min-date and data-max-date must be server serialized date strings; they are run through deserializeDate or deserializeDateTime, so human formats like 31/12/2026 will not parse.
Working examples
PublicWidget to Interaction: the 19.0 rewrite
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Present in the development branch with internal cleanup only; see below. |
| Odoo 19.0 | Verified | Rewritten as an Interaction (web.datetime_picker); verified against the shipped source. |
| Odoo 18.0 | Verified | Legacy PublicWidget implementation, same selector and data attributes. |
| Odoo 17.0 | Verified | Same PublicWidget implementation as 18.0. |
| Odoo 16.0 | Not available | The shared frontend picker does not exist in 16.0. |
The HTML contract (selector plus three data attributes) is identical in 17, 18 and 19, so templates migrate untouched. JavaScript that patched the old PublicWidget class must be rewritten for the Interaction framework in 19.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| widget="datetime-picker" on a form view field does nothing | The name is a public interaction, not a field widget; it is never registered in the fields registry. Use widget="datetime" or widget="date" in backend views; use the data attribute only on website inputs. |
| The picker does not appear on my website form input | The element does not match [data-widget='datetime-picker'], or the page does not load the public interactions bundle. Add data-widget="datetime-picker" to the input and confirm the page uses the standard website layout assets. |
| data-min-date seems ignored | The value is in a display format; the interaction deserializes server format strings only. Emit the bound as a serialized value, e.g. 2026-12-31 or 2026-12-31 23:59:59. |
| Custom JS that patched DateTimePickerWidget broke after upgrading to 19 | The legacy PublicWidget class was replaced by an Interaction registered as web.datetime_picker. Rewrite the patch against the interaction class in web/static/src/public/datetime_picker.js. |
Datetime-picker interaction vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
datetime-picker | Date and datetime inputs on public website and portal pages | Activated by an HTML data attribute in QWeb templates, not by widget= in view XML |
| datetime | Datetime fields in backend views | Real field widget with options like show_seconds and range pairing |
date | Date only fields in backend views | Field widget bound to record data, no HTML attributes involved |
| daterange | Start and end date pairs on one line | Links two backend fields into a single range popover |
Frequently asked questions
Is datetime-picker an Odoo field widget?+
How do I add an Odoo date picker to a website form?+
How do I limit the selectable dates?+
Where does Odoo core use datetime-picker?+
Did the implementation change recently?+
Website forms that collect clean data
Portal deadline forms, booking widgets, custom registration flows: we build Odoo website features where dates arrive valid, localized and bounded, and where an upgrade to the next Odoo version does not break your frontend JavaScript.
Build my portal form