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

@commercetools-uikit/date-range-input

Package Overview
Dependencies
Maintainers
0
Versions
1060
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/date-range-input

The `DateRangeInput` component allows the user to select a date range.

  • 19.12.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
increased by33.1%
Maintainers
0
Weekly downloads
 
Created
Source

DateRangeInput

Description

The DateRangeInput component allows the user to select a date range.

Installation

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

Additionally install the peer dependencies (if not present)

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

Usage

import DateRangeInput from '@commercetools-uikit/date-range-input';

const Example = () => (
  <DateRangeInput
    placeholder="Select a date..."
    value={['2017-01-11', '2017-01-14']}
    onChange={() => {}}
  />
);

export default Example;

Properties

PropsTypeRequiredDefaultDescription
horizontalConstraintunion
Possible values:
, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'
Horizontal size limit of the input field.
valueArray: MomentInput[]The selected date range, must either be an empty array or an array of two strings holding dates formatted as "YYYY-MM-DD".
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.
onChangeFunction
See signature.
Called when the date range changes. Called with an event containing either an empty array (no value) or an array holding two string in this format: "YYYY-MM-DD".
isClearablebooleantrueAllows the range to be cleared
onFocusFunction
See signature.
Called when the date input gains focus.
onBlurFunction
See signature.
Called when the date input loses focus.
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 makes input field read-only
hasErrorbooleanIndicates the input field has an error
hasWarningbooleanIndicates the input field has warning

Signatures

Signature onChange

(event: TCustomEvent) => void

Signature onFocus

(event: TCustomEvent) => void

Signature onBlur

(event: TCustomEvent) => void

data-* props

The component further forwards all data- attributes to the underlying input component.

Static methods

DateRangeInput.isEmpty

Returns true when the value is considered empty, which is when the value is an empty array.

TextInput.isEmpty([]); // -> true
TextInput.isEmpty(['2018-09-20', '2018-09-24']); // -> false

Keywords

FAQs

Package last updated on 16 Sep 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