# Time > BootstrapVue's custom `` component generates a WAI-ARIA compliant time selection widget, > which can be used to control other components, or can be used to create customized time picker > inputs. ## Overview `` is WAI-ARIA accessibility compliant, optimized for keyboard control (arrow, page up/down, home, and end keys). Internationalization is also supported, and default's to the browser's or page's locale, if no locale(s) are specified. If you need a time picker as a custom form control input, use the [``](/docs/components/form-timepicker) component instead. ```html ``` ## `v-model` return value `` always returns a string in the format of `HH:mm:ss` which is the same format returned by native browser `` controls. The value will be in the range of `'00:00:00'` up to `'23:59:59'` (24-hour clock using the `'h23'` hour cycle syntax) If no time is selected, then `` returns an empty string (`''`). ## Disabled and readonly states Setting the `disabled` prop will remove all interactivity of the `` component. Setting the `readonly` prop will disable selecting a time, but will keep the spinbuttons focusable. ```html ``` ## Styling ### Enabling of seconds spinbutton By default, the seconds spinbutton is not shown. To enable the section of seconds, set the `show-seconds` prop to `true` to enable the seconds selection spinbutton. When `show-seconds` is `false` (or not provided), the returned value will always have the seconds portion of the time string set to `00`. ```html ``` ### Hiding the top selected time header By default, the current selected time will be displayed at the top of the time component, formatted in the locale's language. You can hide this header via the `hide-header` prop. Note this only visually hides the selected time, while keeping it available to screen reader users as an `aria-live` region. ### Border and padding Fancy a time control with a border with padding? Use Bootstrap's border and padding utility classes to add borders and padding: ```html ``` ### Default slot Provide optional content at the bottom of the time interface via the use of `default` slot. The slot can be used to add buttons such as Now or Reset, etc. ```html ``` ## Events ### `input` event The `'input'` event is emitted when updating the `v-model`. The event has a single argument which is the selected time as a string. The value is a string in the format of `'HH:mm:ss'` (or an empty string if no time is selected). Valid values are in the range of `'00:00:00'` through `23:59:59'`. If fhe `show-seconds` prop is not set, the seconds portion of the time value will always be `'00'`. If the `disabled` or `readonly` props are set, the `'input'` event will **not** be emitted. ### `context` event The `'context'` event is emitted whenever a user selects a time, or the user changes a value of one of the spinbuttons. It will also be emitted when the component is created (just before insertion into the DOM), or when the resolved locale has changed. The event will not be emitted when the `disabled` or `readonly` props are set (except for the initial emit when the time component is created). The `'context'` event is passed a context object as it's only argument, with the following properties: | Property | Description | | ----------- | ----------------------------------------------------------------------------------------------------------- | | `value` | The current value as an `HH:mm:ss` string or an empty string `''` if no time selected | | `formatted` | The current value formatted in the resolved locale, or the `label-no-time` prop value if no time selected | | `hours` | The currently selected hour (always 24 hour, `h23'` format) as a number or `null` if no hour | | `minutes` | The currently selected minute value as a number or `null` if no minute | | `seconds` | The currently selected seconds value as a number or `null` if no seconds | | `locale` | The locale resolved by the time picker, this _may_ be different than the requested locale | | `isRTL` | Will be `true` is the locale is RTL (right-to-left) | | `hour12` | Boolean value indicating if the interface is using 12 hour format | | `hourCycle` | A string representing the type of hour cycle used for the spinbuttons: `'h11'`, `'h12'`, `'h23'` or `'h24'` | Refer to the [Internationalization section](#internationalization) for information on the context properties `locale`, `hour12` and `hourCycle`. ## Internationalization Internationalization of the time interface is provided via [`Intl.DateTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat) and [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat), except for the labels applied to elements of the time control (aria-labels, selected status, etc.). You must provide your own translations for these labels. The available locales will be browser dependent (not all browsers support all locales). By default `` will use the browser's default locale, but you can specify the locale (or locales) to use via the `locale` prop. The prop accepts either a single locale string, or an array of locale strings (listed in order of most preferred locale to least preferred). The emitted `'context'` event will include which locale the time control has resolved to (which may not be the same locale as requested, depending on the supported locales of `Intl`). For server side rendering (SSR) when using Node.js, ensure that the Node.js runtime you are using supports `Intl` and the locales you will be using. Refer to the [Node Intl support documentation](https://nodejs.org/api/intl.html) for details. ```html ``` ### Understanding the `hourCycle` There are 2 main types of time keeping conventions (clocks) used around the world: the 12-hour clock and the 24-hour clock. The `hourCycle` property allows you to access the clock type used by a particular locale. The hour cycle type can have several different values, which are listed in the table below. The `hourCycle` signals how the time `'00:00:00'` (the start of the day) should be presented/formatted to a user of a particular locale. The [`'context'` event](#context-event) includes the resolved `hourCycle` value. | `hourCycle` | Description | | ----------- | --------------------------------------------------------------------------------- | | `'h12'` | Hour system using `1`–`12`. The 12 hour clock, with midnight starting at 12:00 am | | `'h23'` | Hour system using `0`–`23`. The 24 hour clock, with midnight starting at 0:00 | | `'h11'` | Hour system using `0`–`11`. The 12 hour clock, with midnight starting at 0:00 am | | `'h24'` | Hour system using `1`–`24`. The 24 hour clock, with midnight starting at 24:00 | Native HTML5 `` returns the time value in the `'h23'` format, and `` also returns the v-model in the `'h23'` format. This value may differ from what is presented to the user via the GUI (spin buttons) of the `` component, dependent upon the [locale selected](#internationalization). **Note:** IE 11 _does not support_ resolving the `hourCycle` value of a locale, so we assume either `h12` or `h23` based on the resolved `hour12` value. ### Forcing 12 or 24 hour interface 12-hour versus 24-hour input is determined by the client browsers default locale (or the locale resolved from the `locale` prop). To force a 12-hour user interface, set the prop `hour12` to `true`. To force a 24-hour user interface, set the prop `hour12` to `false`. The default for prop `hour12` is `null` which uses the resolved locale to determine which interface to use. The setting of the `hour12` prop will affect which [`hourCycle`](#understanding-the-hourcycle) is resolved for formatting the hours spinbutton. Note that while this may affect the format of the hour spinbutton, but the formatted time string result _may_ show the `'h12` or `'h23'` format due to limitations in the client `Intl.DateTimeFormat` support for a particular locale. It is therefore **recommended to leave the `hour12` prop set to `null` (default)**, so show the locale default time/hour formatting. ## Accessibility `` provides many accessibility features, such as `aria-live` regions, roles, aria labeling, shortcut keys and full keyboard navigation to work with most screen readers. Keyboard navigation: - ArrowUp Increments the currently selected spinbutton value - ArrowDown Decrements the currently selected spinbutton value - Home Sets the selected spinbutton to the minimum value - End Sets the selected spinbutton to the maximum value - PageUp Increases the selected spinbutton value by the spinbutton's step by a larger value - PageDown Decreases the selected spinbutton value by the spinbutton's step by a larger value - ArrowRight Moves focus to the next spin button in the component - ArrowLeft Moves focus to the previous spin button in the component Several of the `label-*` props are not visible on screen, but are used to label various elements within the calendar for screen reader users. e.g. the `label-selected` prop is added to the element that displays the selected value. When internationalizing the datepicker, it is important to also update the `label-*` props with appropriate translated strings, so that international screen reader users will hear the correct prompts and descriptions. ## Implementation notes The `` component is based upon the custom BootstrapVue component [``](/docs/components/form-spinbutton). `` uses Bootstrap's border and flex utility classes, along with button (`btn-*`) classes and the `form-control` class. BootstrapVue's custom SCSS/CSS is also required for proper styling. ## See also - [`` Time picker custom form input](/docs/components/form-timepicker) - [`` Calendar date selection widget](/docs/components/calendar) - [`` Date picker custom form input](/docs/components/form-datepicker)