react-datetime-picker
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -6,3 +6,3 @@ import React from 'react'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import type { ClassName, Detail, LooseValue } from './shared/types'; | ||
import type { ClassName, Detail, LooseValue, Value } from './shared/types'; | ||
type Icon = React.ReactElement | string; | ||
@@ -45,3 +45,3 @@ type IconOrRenderFunction = Icon | React.ComponentType | React.ReactElement; | ||
onCalendarOpen?: () => void; | ||
onChange?: (value: Date | null) => void; | ||
onChange?: (value: Value) => void; | ||
onClockClose?: () => void; | ||
@@ -59,3 +59,3 @@ onClockOpen?: () => void; | ||
yearPlaceholder?: string; | ||
} & Omit<React.ComponentPropsWithoutRef<typeof Calendar>, 'className' | 'maxDetail' | 'minDetail' | 'onChange'> & Omit<React.ComponentPropsWithoutRef<typeof Clock>, 'value'>; | ||
} & Omit<React.ComponentPropsWithoutRef<typeof Calendar>, 'className' | 'maxDetail' | 'onChange'> & Omit<React.ComponentPropsWithoutRef<typeof Clock>, 'value'>; | ||
declare function DateTimePicker(props: DateTimePickerProps): JSX.Element; | ||
@@ -62,0 +62,0 @@ declare namespace DateTimePicker { |
@@ -140,2 +140,3 @@ "use strict"; | ||
function onDateChange(nextValue, shouldCloseWidgets) { | ||
// React-Calendar passes an array of values when selectRange is enabled | ||
var nextValueFrom = (Array.isArray(nextValue) ? nextValue : [nextValue])[0]; | ||
@@ -150,3 +151,3 @@ var valueFrom = (Array.isArray(value) ? value : [value])[0]; | ||
else { | ||
onChange(nextValueFrom || null, shouldCloseWidgets); | ||
onChange(nextValueFrom, shouldCloseWidgets); | ||
} | ||
@@ -153,0 +154,0 @@ } |
@@ -6,4 +6,2 @@ export type AmPmType = 'am' | 'pm'; | ||
export type LooseValue = LooseValuePiece | [LooseValuePiece, LooseValuePiece]; | ||
type ValuePiece = Date | null; | ||
export type Value = ValuePiece | [ValuePiece, ValuePiece]; | ||
export {}; | ||
export type Value = Date | null; |
@@ -6,3 +6,3 @@ import React from 'react'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import type { ClassName, Detail, LooseValue } from './shared/types'; | ||
import type { ClassName, Detail, LooseValue, Value } from './shared/types'; | ||
type Icon = React.ReactElement | string; | ||
@@ -45,3 +45,3 @@ type IconOrRenderFunction = Icon | React.ComponentType | React.ReactElement; | ||
onCalendarOpen?: () => void; | ||
onChange?: (value: Date | null) => void; | ||
onChange?: (value: Value) => void; | ||
onClockClose?: () => void; | ||
@@ -59,3 +59,3 @@ onClockOpen?: () => void; | ||
yearPlaceholder?: string; | ||
} & Omit<React.ComponentPropsWithoutRef<typeof Calendar>, 'className' | 'maxDetail' | 'minDetail' | 'onChange'> & Omit<React.ComponentPropsWithoutRef<typeof Clock>, 'value'>; | ||
} & Omit<React.ComponentPropsWithoutRef<typeof Calendar>, 'className' | 'maxDetail' | 'onChange'> & Omit<React.ComponentPropsWithoutRef<typeof Clock>, 'value'>; | ||
declare function DateTimePicker(props: DateTimePickerProps): JSX.Element; | ||
@@ -62,0 +62,0 @@ declare namespace DateTimePicker { |
@@ -112,2 +112,3 @@ var __assign = (this && this.__assign) || function () { | ||
function onDateChange(nextValue, shouldCloseWidgets) { | ||
// React-Calendar passes an array of values when selectRange is enabled | ||
var nextValueFrom = (Array.isArray(nextValue) ? nextValue : [nextValue])[0]; | ||
@@ -122,3 +123,3 @@ var valueFrom = (Array.isArray(value) ? value : [value])[0]; | ||
else { | ||
onChange(nextValueFrom || null, shouldCloseWidgets); | ||
onChange(nextValueFrom, shouldCloseWidgets); | ||
} | ||
@@ -125,0 +126,0 @@ } |
@@ -6,4 +6,2 @@ export type AmPmType = 'am' | 'pm'; | ||
export type LooseValue = LooseValuePiece | [LooseValuePiece, LooseValuePiece]; | ||
type ValuePiece = Date | null; | ||
export type Value = ValuePiece | [ValuePiece, ValuePiece]; | ||
export {}; | ||
export type Value = Date | null; |
{ | ||
"name": "react-datetime-picker", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "A date range picker for your React app.", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"source": "src/index.js", | ||
"source": "src/index.ts", | ||
"types": "dist/cjs/index.d.ts", | ||
"sideEffects": [ | ||
@@ -9,0 +10,0 @@ "*.css" |
@@ -11,4 +11,2 @@ export type AmPmType = 'am' | 'pm'; | ||
type ValuePiece = Date | null; | ||
export type Value = ValuePiece | [ValuePiece, ValuePiece]; | ||
export type Value = Date | null; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
291320
5922