title |
---|
ion-datetime-button |
import Props from '@ionic-internal/component-api/v8/datetime-button/props.md'; import Events from '@ionic-internal/component-api/v8/datetime-button/events.md'; import Methods from '@ionic-internal/component-api/v8/datetime-button/methods.md'; import Parts from '@ionic-internal/component-api/v8/datetime-button/parts.md'; import CustomProps from '@ionic-internal/component-api/v8/datetime-button/custom-props.mdx'; import Slots from '@ionic-internal/component-api/v8/datetime-button/slots.md';
<title>ion-datetime-button: Ionic Input for Datetime Picker</title>import EncapsulationPill from '@components/page/api/EncapsulationPill';
Datetime Button links with a Datetime component to display the formatted date and time. It also provides buttons to present the datetime in a modal, popover, and more.
Datetime Button should be used when space is constrained. This component displays buttons which show the current date and time values. When the buttons are tapped, the date or time pickers open in the overlay.
When using Datetime Button with a JavaScript framework such as Angular, React, or Vue be sure to use the keepContentsMounted property on ion-modal or the keepContentsMounted property on ion-popover. This allows the linked datetime instance to be mounted even if the overlay has not been presented yet.
import Basic from '@site/static/usage/v8/datetime-button/basic/index.md';
The localized text on ion-datetime-button
is determined by the locale
property on the associated ion-datetime
instance. See Datetime Localization for more details.
You can customize the format of the date and time in a Datetime Button by providing formatOptions
on the associated Datetime instance. See Datetime Format Options for more details.
import FormatOptions from '@site/static/usage/v8/datetime-button/format-options/index.md';
ion-datetime-button
must be associated with a mounted ion-datetime
instance. As a result, Inline Modals and Inline Popovers with the keepContentsMounted
property set to true
must be used.