Skip to Content
Logo of RG Logo of RG
  • Home
  • Shop
  • Events
  • Courses
  • Company
    • News
    • Success Stories
  • Odoo Docs 19
  • Appointment
  • Jobs
  • Contact us
  • 0
  • 0
  • +1 555-555-5556
  • Sign in
Logo of RG Logo of RG
  • 0
  • 0
    • Home
    • Shop
    • Events
    • Courses
    • Company
      • News
      • Success Stories
    • Odoo Docs 19
    • Appointment
    • Jobs
    • Contact us
  • +1 555-555-5556
  • Sign in
Odoo Docs 19
Home Components Guides Classes Search
418 components
Inputs
  • Auto Complete
  • Check Box
  • Color Picker Custom Tab
  • Color Picker Solid Tab
  • Custom Color Picker
  • Date Time Input
  • Datetime Picker
  • Date Time Picker
  • File Input
  • Record Autocomplete
  1. Components
  2. Date Time Input
OWL inputs

Date Time Input

Odoo 19 OWL component — Date Time Input (core)

Live preview Interactive
Source excerpt web/static/src/core/datetime/datetime_input.js
import { Component } from "@odoo/owl";
import { omit } from "../utils/objects";
import { DateTimePicker } from "./datetime_picker";
import { useDateTimePicker } from "./datetime_picker_hook";

/**
 * @typedef {import("./datetime_picker").DateTimePickerProps & {
 *  format?: string;
 *  id?: string;
 *  onApply?: (value: DateTime) => any;
 *  onChange?: (value: DateTime) => any;
 *  placeholder?: string;
 * }} DateTimeInputProps
 */

const dateTimeInputOwnProps = {
    format: { type: String, optional: true },
    id: { type: String, optional: true },
    class: { type: String, optional: true },
    onChange: { type: Function, optional: true },
    onApply: { type: Function, optional: true },
    placeholder: { type: String, optional: true },
    disabled: { type: Boolean, optional: true },
};

/** @extends {Component<DateTimeInputProps>} */
export class DateTimeInput extends Component {
    static props = {
        ...DateTimePicker.props,
        ...dateTimeInputOwnProps,
    };

    static template = "web.DateTimeInput";

    setup() {
        const getPickerProps = () => omit(this.props, ...Object.keys(dateTimeInputOwnProps));

        useDateTimePicker({
            format: this.props.format,
            showSeconds: this.props.rounding <= 0,
            get pickerProps() {
                return getPickerProps();
            },
            onApply: (...args) => this.props.onApply?.(...args),
            onChange: (...args) => this.props.onChange?.(...args),
        });
    }
}
Registry / API
Registry name
DateTimeInput
Category
—
Module
web
Slug
date-time-input
Nav group
inputs
Follow us

250 Executive Park Blvd, Suite 3400
San Francisco CA 94134

  • +1 555-555-5556
  • info@yourcompany.example.com
Copyright © Company name
Powered by Odoo - The #1 Open Source eCommerce