Class DateTimePicker

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<DateTimePicker,LocalDateTime>
com.vaadin.flow.component.datetimepicker.DateTimePicker
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<DateTimePicker>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<DateTimePicker>, com.vaadin.flow.component.FocusNotifier<DateTimePicker>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>, com.vaadin.flow.component.shared.HasAutoOpen, com.vaadin.flow.component.shared.HasClientValidation, com.vaadin.flow.component.shared.HasOverlayClassName, com.vaadin.flow.component.shared.HasThemeVariant<DateTimePickerVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>, com.vaadin.flow.data.binder.HasValidator<LocalDateTime>, Serializable

@Tag("vaadin-date-time-picker") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="24.7.12") @NpmPackage(value="@vaadin/date-time-picker",version="24.7.12") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/date-time-picker/src/vaadin-date-time-picker.js") public class DateTimePicker extends com.vaadin.flow.component.AbstractSinglePropertyField<DateTimePicker,LocalDateTime> implements com.vaadin.flow.component.Focusable<DateTimePicker>, com.vaadin.flow.component.shared.HasAutoOpen, com.vaadin.flow.component.shared.HasClientValidation, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>, com.vaadin.flow.component.shared.HasOverlayClassName, com.vaadin.flow.component.shared.HasThemeVariant<DateTimePickerVariant>, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<LocalDateTime>
Date Time Picker is an input field for selecting both a date and a time. The date and time can be entered directly using a keyboard in the format of the current locale or through the Date Time Picker’s two overlays. The overlays open when their respective fields are clicked or any input is entered when the fields are focused.
Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The internationalization properties for DateTimePicker.

    Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField

    com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.shared.HasClientValidation

    com.vaadin.flow.component.shared.HasClientValidation.ClientValidatedEvent

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue

    com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    DateTimePicker(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
    Convenience constructor to create a date time picker with a HasValue.ValueChangeListener.
    Convenience constructor to create a date time picker with a label.
    DateTimePicker(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
    Convenience constructor to create a date time picker with a HasValue.ValueChangeListener and a label.
    DateTimePicker(String label, LocalDateTime initialDateTime)
    Convenience constructor to create a date time picker with a pre-selected date and time in current UI locale format and a label.
    DateTimePicker(String label, LocalDateTime initialDateTime, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
    Convenience constructor to create a date time picker with a pre-selected date and time in current UI locale format, a HasValue.ValueChangeListener and a label.
    DateTimePicker(LocalDateTime initialDateTime)
    Convenience constructor to create a date time picker with a pre-selected date time in current UI locale format.
    DateTimePicker(LocalDateTime initialDateTime, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
    Convenience constructor to create a date time picker with a pre-selected date time in current UI locale format and a HasValue.ValueChangeListener.
    DateTimePicker(LocalDateTime initialDateTime, Locale locale)
    Convenience constructor to create a date time picker with pre-selected date time and locale setup.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addThemeName(String themeName)
    Adds a theme name to this component.
    void
    addThemeNames(String... themeNames)
    Adds one or more theme names to this component.
    com.vaadin.flow.shared.Registration
    addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<LocalDateTime> listener)
     
    Gets the aria-label of the component.
    Gets the aria-label suffix for the date picker.
    Gets the internationalization object previously set for this component.
    Gets the placeholder string of the date field.
    com.vaadin.flow.data.binder.Validator<LocalDateTime>
     
    Gets the internationalization object previously set for this component.
    Gets the label of this field.
    Gets the Locale for this DateTimePicker
    Gets the maximum date and time in the date time picker.
    Gets the minimum date and time in the date time picker.
    Gets the step of the time picker.
    Gets the aria-label suffix for the time picker.
    Gets the placeholder string of the time field.
    boolean
    Get the state of showWeekNumbers property of the date picker.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    boolean
    Removes a theme name from this component.
    void
    removeThemeNames(String... themeNames)
    Removes one or more theme names from component.
    void
    setAriaLabel(String ariaLabel)
    Sets the aria-label for the component.
    void
    setAutoOpen(boolean autoOpen)
    When auto open is enabled, the dropdown will open when the field is clicked.
    void
    Sets the aria-label suffix for the date picker.
    void
    Sets the internationalization properties for the date picker inside this component.
    void
    Sets a placeholder string for the date field.
    void
    Sets the internationalization properties for this component.
    void
    setInvalid(boolean invalid)
     
    void
    Sets the label for this field.
    void
    setLocale(Locale locale)
    Set the Locale for the DateTimePicker.
    void
    setManualValidation(boolean enabled)
     
    void
    Sets the maximum date and time in the date time picker.
    void
    Sets the minimum date and time in the date time picker.
    void
    setReadOnly(boolean readOnly)
     
    void
    Sets the step property of the time picker using duration.
    void
    setThemeName(String themeName)
    Sets the theme names of this component.
    void
    setThemeName(String themeName, boolean set)
    Sets or removes the given theme name for this component.
    void
    Sets the aria-label suffix for the time picker.
    void
    Set a placeholder string for the time field.
    void
    Sets the selected date and time value of the component.
    void
    setWeekNumbersVisible(boolean weekNumbersVisible)
    Show or hide the week numbers in the date picker.
    protected void
    Validates the current value against the constraints and sets the invalid property and the errorMessage property based on the result.

    Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField

    getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, valueEquals

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.shared.HasAutoOpen

    isAutoOpen

    Methods inherited from interface com.vaadin.flow.component.shared.HasClientValidation

    addClientValidatedEventListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasHelper

    getHelperComponent, getHelperText, setHelperComponent, setHelperText

    Methods inherited from interface com.vaadin.flow.component.shared.HasOverlayClassName

    getOverlayClassName, setOverlayClassName

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    getThemeName, getThemeNames, hasThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, removeThemeVariants

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    getTooltip, setTooltipText

    Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties

    getErrorMessage, isInvalid, setErrorMessage

    Methods inherited from interface com.vaadin.flow.component.HasValue

    addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
  • Constructor Details

    • DateTimePicker

      public DateTimePicker()
      Default constructor.
    • DateTimePicker

      public DateTimePicker(String label)
      Convenience constructor to create a date time picker with a label.
      Parameters:
      label - the label describing the date time picker
      See Also:
    • DateTimePicker

      public DateTimePicker(String label, LocalDateTime initialDateTime)
      Convenience constructor to create a date time picker with a pre-selected date and time in current UI locale format and a label.
      Parameters:
      label - the label describing the date time picker
      initialDateTime - the pre-selected date time in the picker
      See Also:
    • DateTimePicker

      public DateTimePicker(LocalDateTime initialDateTime)
      Convenience constructor to create a date time picker with a pre-selected date time in current UI locale format.
      Parameters:
      initialDateTime - the pre-selected date time in the picker
    • DateTimePicker

      public DateTimePicker(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
      Convenience constructor to create a date time picker with a HasValue.ValueChangeListener.
      Parameters:
      listener - the listener to receive value change events
      See Also:
      • AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
    • DateTimePicker

      public DateTimePicker(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
      Convenience constructor to create a date time picker with a HasValue.ValueChangeListener and a label.
      Parameters:
      label - the label describing the date time picker
      listener - the listener to receive value change events
      See Also:
      • setLabel(String)
      • AbstractField.addValueChangeListener(HasValue.ValueChangeListener)
    • DateTimePicker

      public DateTimePicker(LocalDateTime initialDateTime, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
      Convenience constructor to create a date time picker with a pre-selected date time in current UI locale format and a HasValue.ValueChangeListener.
      Parameters:
      initialDateTime - the pre-selected date time in the picker
      listener - the listener to receive value change events
      See Also:
    • DateTimePicker

      public DateTimePicker(String label, LocalDateTime initialDateTime, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>> listener)
      Convenience constructor to create a date time picker with a pre-selected date and time in current UI locale format, a HasValue.ValueChangeListener and a label.
      Parameters:
      label - the label describing the date time picker
      initialDateTime - the pre-selected date time in the picker
      listener - the listener to receive value change events
      See Also:
    • DateTimePicker

      public DateTimePicker(LocalDateTime initialDateTime, Locale locale)
      Convenience constructor to create a date time picker with pre-selected date time and locale setup.
      Parameters:
      initialDateTime - the pre-selected date time in the picker
      locale - the locale for the date time picker
  • Method Details

    • setValue

      public void setValue(LocalDateTime value)
      Sets the selected date and time value of the component. The value can be cleared by setting null.

      The value will be truncated to millisecond precision, as that is the maximum that the time picker supports. This means that AbstractField.getValue() might return a different value than what was passed in.

      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>
      Overrides:
      setValue in class com.vaadin.flow.component.AbstractField<DateTimePicker,LocalDateTime>
      Parameters:
      value - the LocalDateTime instance representing the selected date and time, or null
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DateTimePicker,LocalDateTime>,LocalDateTime>
    • setInvalid

      public void setInvalid(boolean invalid)
      Specified by:
      setInvalid in interface com.vaadin.flow.component.HasValidation
      Specified by:
      setInvalid in interface com.vaadin.flow.component.shared.HasValidationProperties
    • setLabel

      public void setLabel(String label)
      Sets the label for this field.
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
      Parameters:
      label - the String value to set
    • getLabel

      public String getLabel()
      Gets the label of this field.
      Specified by:
      getLabel in interface com.vaadin.flow.component.HasLabel
      Returns:
      the label property of the date time picker
    • setAriaLabel

      public void setAriaLabel(String ariaLabel)
      Sets the aria-label for the component.
      Parameters:
      ariaLabel - the value to set as aria-label
    • getAriaLabel

      public Optional<String> getAriaLabel()
      Gets the aria-label of the component.
      Returns:
      an optional aria-label or an empty optional if no aria-label has been set
    • setDateAriaLabel

      public void setDateAriaLabel(String dateLabel)
      Sets the aria-label suffix for the date picker.

      The suffix set with this method takes precedence over the suffix set with DateTimePicker.DateTimePickerI18n.setDateLabel(String).

      The date picker's final aria-label is a concatenation of DateTimePicker's getAriaLabel() or getLabel() and this suffix.

      Parameters:
      dateLabel - the value to be used as a suffix in the date picker aria-label.
    • getDateAriaLabel

      public Optional<String> getDateAriaLabel()
      Gets the aria-label suffix for the date picker.

      Note: this method will return the last value passed to setDateAriaLabel(String), not the value currently set on the `aria-label` attribute of the date picker input element.

      Returns:
      an optional label or an empty optional if no label has been set with this method before.
    • setTimeAriaLabel

      public void setTimeAriaLabel(String timeLabel)
      Sets the aria-label suffix for the time picker.

      The suffix set with this method takes precedence over the suffix set with DateTimePicker.DateTimePickerI18n.setTimeLabel(String).

      The time picker's final aria-label is a concatenation of DateTimePicker's getAriaLabel() or getLabel() and this suffix.

      Parameters:
      timeLabel - the value to be used as a suffix in the time picker aria-label.
    • getTimeAriaLabel

      public Optional<String> getTimeAriaLabel()
      Gets the aria-label suffix for the time picker.

      Note: this method will return the last value passed to setTimeAriaLabel(String), not the value currently set on the `aria-label` attribute of the time picker input element.

      Returns:
      an optional label or an empty optional if no label has been set with this method before.
    • setDatePlaceholder

      public void setDatePlaceholder(String placeholder)
      Sets a placeholder string for the date field.
      Parameters:
      placeholder - the String value to set
    • getDatePlaceholder

      public String getDatePlaceholder()
      Gets the placeholder string of the date field.
      Returns:
      the placeholder property of the date picker
    • setTimePlaceholder

      public void setTimePlaceholder(String placeholder)
      Set a placeholder string for the time field.
      Parameters:
      placeholder - the String value to set
    • getTimePlaceholder

      public String getTimePlaceholder()
      Gets the placeholder string of the time field.
      Returns:
      the placeholder property of the time picker
    • setStep

      public void setStep(Duration step)
      Sets the step property of the time picker using duration. It specifies the intervals for the displayed items in the time picker dropdown and also the displayed time format.

      The set step needs to evenly divide a day or an hour and has to be larger than 0 milliseconds. By default, the format is hh:mm (same as * Duration.ofHours(1)

      If the step is less than 60 seconds, the format will be changed to hh:mm:ss and it can be in hh:mm:ss.fff format, when the step is less than 1 second.

      NOTE: If the step is less than 900 seconds, the dropdown is hidden.

      NOTE: changing the step to a larger duration can cause a new HasValue.ValueChangeEvent to be fired if some parts (eg. seconds) is discarded from the value.

      Parameters:
      step - the step to set, not null and should divide a day or an hour evenly
    • getStep

      public Duration getStep()
      Gets the step of the time picker.
      Returns:
      the step property from the picker, unit seconds
    • setWeekNumbersVisible

      public void setWeekNumbersVisible(boolean weekNumbersVisible)
      Show or hide the week numbers in the date picker. By default the week numbers are not shown.

      Set true to display ISO-8601 week numbers in the calendar.

      Note that displaying of week numbers is only supported when datePickerI18n.firstDayOfWeek is 1 (Monday).

      Parameters:
      weekNumbersVisible - the boolean value to set
      See Also:
    • isWeekNumbersVisible

      public boolean isWeekNumbersVisible()
      Get the state of showWeekNumbers property of the date picker.
      Returns:
      the showWeekNumbers property from the date picker
    • setLocale

      public void setLocale(Locale locale)
      Set the Locale for the DateTimePicker. The displayed date and time will be matched to the format used in that locale.
      Parameters:
      locale - the locale to set to the DateTimePicker, cannot be null
    • getLocale

      public Locale getLocale()
      Gets the Locale for this DateTimePicker
      Overrides:
      getLocale in class com.vaadin.flow.component.Component
      Returns:
      the locale used for this DateTimePicker
    • addThemeName

      public void addThemeName(String themeName)
      Adds a theme name to this component.
      Specified by:
      addThemeName in interface com.vaadin.flow.component.HasTheme
      Parameters:
      themeName - the theme name to add, not null
    • removeThemeName

      public boolean removeThemeName(String themeName)
      Removes a theme name from this component.
      Specified by:
      removeThemeName in interface com.vaadin.flow.component.HasTheme
      Parameters:
      themeName - the theme name to remove, not null
      Returns:
      true if the theme name was removed, false if the theme list didn't contain the theme name
    • setThemeName

      public void setThemeName(String themeName)
      Sets the theme names of this component. This method overwrites any previous set theme names.
      Specified by:
      setThemeName in interface com.vaadin.flow.component.HasTheme
      Parameters:
      themeName - a space-separated string of theme names to set, or empty string to remove all theme names
    • setThemeName

      public void setThemeName(String themeName, boolean set)
      Sets or removes the given theme name for this component.
      Specified by:
      setThemeName in interface com.vaadin.flow.component.HasTheme
      Parameters:
      themeName - the theme name to set or remove, not null
      set - true to set the theme name, false to remove it
    • addThemeNames

      public void addThemeNames(String... themeNames)
      Adds one or more theme names to this component. Multiple theme names can be specified by using multiple parameters.
      Specified by:
      addThemeNames in interface com.vaadin.flow.component.HasTheme
      Parameters:
      themeNames - the theme name or theme names to be added to the component
    • removeThemeNames

      public void removeThemeNames(String... themeNames)
      Removes one or more theme names from component. Multiple theme names can be specified by using multiple parameters.
      Specified by:
      removeThemeNames in interface com.vaadin.flow.component.HasTheme
      Parameters:
      themeNames - the theme name or theme names to be removed from the component
    • getDefaultValidator

      public com.vaadin.flow.data.binder.Validator<LocalDateTime> getDefaultValidator()
      Specified by:
      getDefaultValidator in interface com.vaadin.flow.data.binder.HasValidator<LocalDateTime>
    • addValidationStatusChangeListener

      public com.vaadin.flow.shared.Registration addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<LocalDateTime> listener)
      Specified by:
      addValidationStatusChangeListener in interface com.vaadin.flow.data.binder.HasValidator<LocalDateTime>
    • setManualValidation

      public void setManualValidation(boolean enabled)
      Specified by:
      setManualValidation in interface com.vaadin.flow.component.HasValidation
    • validate

      protected void validate()
      Validates the current value against the constraints and sets the invalid property and the errorMessage property based on the result. If a custom error message is provided with HasValidationProperties.setErrorMessage(String), it is used. Otherwise, the error message defined in the i18n object is used.

      The method does nothing if the manual validation mode is enabled.

    • setMin

      public void setMin(LocalDateTime min)
      Sets the minimum date and time in the date time picker. Dates and times before that will be disabled in the popups.
      Parameters:
      min - the minimum date and time that is allowed to be set, or null to remove any minimum constraints
    • getMin

      public LocalDateTime getMin()
      Gets the minimum date and time in the date time picker. Dates and times before that will be disabled in the popups.
      Returns:
      the minimum date and time that is allowed to be set, or null if there's no minimum
    • setMax

      public void setMax(LocalDateTime max)
      Sets the maximum date and time in the date time picker. Dates and times above that will be disabled in the popups.
      Parameters:
      max - the maximum date and time that is allowed to be set, or null to remove any minimum constraints
    • getMax

      public LocalDateTime getMax()
      Gets the maximum date and time in the date time picker. Dates and times above that will be disabled in the popups.
      Returns:
      the maximum date and time that is allowed to be set, or null if there's no minimum
    • getDatePickerI18n

      public DatePicker.DatePickerI18n getDatePickerI18n()
      Gets the internationalization object previously set for this component.

      NOTE: Updating the instance that is returned from this method will not update the component if not set again using setDatePickerI18n(DatePickerI18n)

      Returns:
      the i18n object or null if no i18n object has been set
    • setDatePickerI18n

      public void setDatePickerI18n(DatePicker.DatePickerI18n i18n)
      Sets the internationalization properties for the date picker inside this component.
      Parameters:
      i18n - the i18n object, not null
    • getI18n

      Gets the internationalization object previously set for this component.

      Note: updating the instance that is returned from this method will not update the component if not set back using setI18n(DateTimePickerI18n)

      Returns:
      the i18n object. It will be null, If the i18n properties weren't set.
    • setI18n

      public void setI18n(DateTimePicker.DateTimePickerI18n i18n)
      Sets the internationalization properties for this component.
      Parameters:
      i18n - the internationalized properties, not null
    • setAutoOpen

      public void setAutoOpen(boolean autoOpen)
      When auto open is enabled, the dropdown will open when the field is clicked.
      Specified by:
      setAutoOpen in interface com.vaadin.flow.component.shared.HasAutoOpen
      Parameters:
      autoOpen - Value for the auto open property,
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component