Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercetools-uikit/date-time-input

Package Overview
Dependencies
Maintainers
0
Versions
1080
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/date-time-input

The `DateTimeInput` component allows the user to select a date. This component also supports multiple date selection.

  • 19.20.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

DateTimeInput

Description

The DateTimeInput component allows the user to select a date. This component also supports multiple date selection.

It formats the selected date depending on the current locale.

Installation

yarn add @commercetools-uikit/date-time-input
npm --save install @commercetools-uikit/date-time-input

Additionally install the peer dependencies (if not present)

yarn add moment react react-intl
npm --save install moment react react-intl

Usage

import DateTimeInput from '@commercetools-uikit/date-time-input';

const Example = () => (
  <DateTimeInput
    placeholder="Select a date..."
    timeZone="Europe/Berlin"
    value="2018-10-04T09:00:00.000Z"
    onChange={() => {}}
  />
);

export default Example;

Properties

PropsTypeRequiredDefaultDescription
aria-invalidbooleanIndicate if the value entered in the input is invalid.
aria-errormessagestringHTML ID of an element containing an error message related to the input.
horizontalConstraintunion
Possible values:
, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'
Horizontal size limit of the input field.
valuestringThe selected date, must either be an empty string or a date formatted in ISO 8601 (e.g. "2018-10-04T09:00:00.000Z").
onChangeFunction
See signature.
Called when the date changes. Called with an event containing an empty string (no value) or a string in this format: "YYYY-MM-DD".
onFocusFocusEventHandlerCalled when the date input gains focus.
onBlurFunction
See signature.
Called when the date input loses focus.
timeZonestringSpecifies the time zone in which the calendar and selected values are shown. It also influences how entered dates and times are parsed. Get list of timezone with moment.tz.names() See moment docs
idstringUsed as the HTML id attribute.
namestringUsed as the HTML name attribute.
placeholderstringPlaceholder value to show in the input field
isCondensedbooleanUse this property to reduce the paddings of the component for a ui compact variant
isDisabledbooleanDisables the date picker
isReadOnlybooleanDisables the date picker menu and sets the input field as read-only
hasErrorbooleanIndicates the input field has an error
hasWarningbooleanIndicates the input field has a warning
defaultDaySelectionTimestringThe time that will be used by default when a user selects a calendar day. It must follow the “HH:mm” pattern (eg: 04:30, 13:25, 23:59)

Signatures

Signature onChange

(event: TCustomEvent) => void

Signature onBlur

(event: TCustomEvent) => void

props.timeZone

The timeZone specifies which time zone the calendar uses, which time zone the selected value is shown in and which time zone entered dates and times are parsed in. For example, given the value is 2018-10-18T00:00:00.000Z and thetimeZoneis set toEurope/Berlin, then entering "13:00" as the time results in theonChangebeing called with2018-10-15T11:00:00.000Z (as the time zone offset for that date is two hours).

Keywords

FAQs

Package last updated on 17 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc