Gathering detailed insights and metrics for @commercetools-uikit/date-range-field
Gathering detailed insights and metrics for @commercetools-uikit/date-range-field
Gathering detailed insights and metrics for @commercetools-uikit/date-range-field
Gathering detailed insights and metrics for @commercetools-uikit/date-range-field
npm install @commercetools-uikit/date-range-field
Typescript
Module System
Node Version
NPM Version
TypeScript (59.12%)
JavaScript (36.8%)
MDX (2.8%)
CSS (1.02%)
HTML (0.16%)
Prolog (0.06%)
Shell (0.04%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
148 Stars
3,452 Commits
27 Forks
15 Watchers
124 Branches
350 Contributors
Updated on Jul 09, 2025
Latest Version
20.2.2
Package Id
@commercetools-uikit/date-range-field@20.2.2
Unpacked Size
47.35 kB
Size
7.81 kB
File Count
12
NPM Version
10.9.2
Node Version
22.17.0
Published on
Jul 08, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
13
1
1
A controlled date input component for a date range, with validation states and a label.
yarn add @commercetools-uikit/date-range-field
npm --save install @commercetools-uikit/date-range-field
Additionally install the peer dependencies (if not present)
yarn add react
npm --save install react
1import DateRangeField from '@commercetools-uikit/date-range-field'; 2 3const Example = () => ( 4 <DateRangeField 5 title="Release Date" 6 value={['2018-09-20', '2018-09-24']} 7 onChange={(event) => alert(event.target.value)} 8 /> 9); 10 11export default Example;
Props | Type | Required | Default | Description |
---|---|---|---|---|
id | string | Used as HTML id property. An id is auto-generated when it is not specified. | ||
horizontalConstraint | union Possible values: , 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto' | 'scale' | Horizontal size limit of the input fields. | |
errors | Record | A map of errors. Error messages for known errors are rendered automatically.
Unknown errors will be forwarded to renderError | ||
renderError | Function See signature. | Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error. | ||
warnings | Record | A map of warnings. Warning messages for known warnings are rendered automatically.
Unknown warnings will be forwarded to renderWarning. | ||
renderWarning | Function See signature. | Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
It can also return null to show no warning. | ||
isRequired | boolean | Indicates if the value is required. Shows an the "required asterisk" if so. | ||
touched | boolean | Indicates whether the field was touched. Errors will only be shown when the field was touched. | ||
name | string | Used as HTML name of the input component. | ||
value | Array: string[] | ✅ | The selected date range. Must either be an empty array or an array of two strings holding dates formatted as "YYYY-MM-DD". | |
onChange | Function See signature. | Called when the date range changes, with an event containing either an empty array (no value) or an array holding two string in this format: "YYYY-MM-DD".
Required when input is not read only. | ||
onBlur | Function See signature. | Called when input is blurred | ||
onFocus | Function See signature. | Called when input is focused | ||
isDisabled | boolean | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). | ||
isReadOnly | boolean | Indicates that the field is displaying read-only content | ||
placeholder | string | Placeholder text for the input | ||
isCondensed | boolean | Use this property to reduce the paddings of the component for a ui compact variant | ||
title | union Possible values: string , ReactNode | ✅ | Title of the label | |
hint | union Possible values: string , ReactNode | Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas description can describe it in more depth. Can also receive a hintIcon . | ||
description | union Possible values: string , ReactNode | Provides a description for the title. | ||
onInfoButtonClick | Function See signature. | Function called when info button is pressed.
Info button will only be visible when this prop is passed. | ||
hintIcon | ReactElement | Icon to be displayed beside the hint text.
Will only get rendered when hint is passed as well. | ||
badge | ReactNode | Badge to be displayed beside the label.
Might be used to display additional information about the content of the field (E.g verified email) |
renderError
1(key: string, error?: boolean) => ReactNode;
renderWarning
1(key: string, warning?: boolean) => ReactNode;
onChange
1(event: TCustomEvent) => void
onBlur
1(event: TCustomEvent) => void
onFocus
1(event: TCustomEvent) => void
onInfoButtonClick
1() => void
data-*
propsThe component further forwards all data-
attributes to the underlying input
component.
errors
This object is a key-value map. The renderError
prop will be called for each entry with the key and the value. The return value will be rendered inside an ErrorMessage
component underneath the input.
The DateRangeField
supports some errors out of the box. Return undefined
from renderError
for these and the default errors will be shown instead. This prevents consumers from having to reimplement the same error messages for known errors while still keeping the flexibility of showing custom error messages for them.
When the key
is known, and when the value is truthy, and when renderError
returned undefined
for that error entry, then the DateRangeField
will render an appropriate error automatically.
Known error keys are:
missing
: tells the user that this field is requiredDateRangeField.toFieldErrors
Use this function to convert the Formik errors
object type to our custom field errors type. This is primarily useful when using TypeScript.
1type FormValues = { 2 myField: string; 3}; 4 5<DateRangeField 6 // ... 7 name="my-field" 8 errors={DateRangeField.toFieldErrors<FormValues>(formik.errors).myField} 9/>;
No vulnerabilities found.
Reason
30 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
SAST tool is run on all commits
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
2 existing vulnerabilities detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More