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

@commercetools-uikit/date-input

Package Overview
Dependencies
Maintainers
0
Versions
1082
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/date-input

The `DateInput` component allows the user to select a date. It formats the selected date depending on the users' locale.

  • 0.0.0-preview-test-icon-bundle-20241210182318
  • preview-test-icon-bundle
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
increased by26.92%
Maintainers
0
Weekly downloads
 
Created
Source

DateInput

Description

The `DateInput` component allows the user to select a date. It formats the selected date depending on the users' locale.

Installation

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

Additionally install the peer dependencies (if not present)

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

Usage

import DateInput from '@commercetools-uikit/date-input';

const Example = () => (
  <DateInput
    placeholder="Select a date..."
    value="2017-12-31"
    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.
valuestringThe selected date, must either be an empty string or a date formatted as "YYYY-MM-DD".
onChangeFunction
See signature.
Called when the date changes. Called with an event containing either 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.
idstringUsed as the HTML id attribute.
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.
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 a warning
minValuestringA minimum selectable date. Must either be an empty string or a date formatted as "YYYY-MM-DD".
maxValuestringA maximum selectable date. Must either be an empty string or a date formatted as "YYYY-MM-DD".

Signatures

Signature onChange

(event: TCustomEvent) => void

Signature onBlur

(event: TCustomEvent) => void

Static methods

DateInput.isEmpty

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

DateInput.isEmpty(''); // -> true
DateInput.isEmpty('2018-09-20'); // -> false

Keywords

FAQs

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