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

react-datetime-picker

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-datetime-picker - npm Package Compare versions

Comparing version 3.4.0 to 3.4.1

140

dist/DateTimeInput.js
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -46,8 +48,6 @@ value: true

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

@@ -59,3 +59,3 @@

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -76,7 +76,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

@@ -93,3 +93,3 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -662,57 +662,2 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

_createClass(DateTimeInput, [{
key: "renderCustomInputs",
value: function renderCustomInputs() {
var placeholder = this.placeholder;
var format = this.props.format;
var elementFunctions = {
d: this.renderDay,
M: this.renderMonth,
y: this.renderYear,
h: this.renderHour,
H: this.renderHour,
m: this.renderMinute,
s: this.renderSecond,
a: this.renderAmPm
};
var allowMultipleInstances = typeof format !== 'undefined';
return _renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
}
}, {
key: "renderNativeInput",
value: function renderNativeInput() {
var _this$props9 = this.props,
disabled = _this$props9.disabled,
maxDate = _this$props9.maxDate,
minDate = _this$props9.minDate,
name = _this$props9.name,
nativeInputAriaLabel = _this$props9.nativeInputAriaLabel,
required = _this$props9.required;
var value = this.state.value;
return /*#__PURE__*/_react["default"].createElement(_NativeInput["default"], {
key: "time",
ariaLabel: nativeInputAriaLabel,
disabled: disabled,
maxDate: maxDate || defaultMaxDate,
minDate: minDate || defaultMinDate,
name: name,
onChange: this.onChangeNative,
required: required,
value: value,
valueType: this.valueType
});
}
}, {
key: "render",
value: function render() {
var className = this.props.className;
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
return /*#__PURE__*/_react["default"].createElement("div", {
className: className,
onClick: this.onClick
}, this.renderNativeInput(), this.renderCustomInputs());
}
}, {
key: "formatTime",

@@ -846,9 +791,9 @@ get: function get() {

get: function get() {
var _this$props10 = this.props,
className = _this$props10.className,
disabled = _this$props10.disabled,
isWidgetOpen = _this$props10.isWidgetOpen,
maxDate = _this$props10.maxDate,
minDate = _this$props10.minDate,
required = _this$props10.required;
var _this$props9 = this.props,
className = _this$props9.className,
disabled = _this$props9.disabled,
isWidgetOpen = _this$props9.isWidgetOpen,
maxDate = _this$props9.maxDate,
minDate = _this$props9.minDate,
required = _this$props9.required;
return {

@@ -887,2 +832,57 @@ className: className,

}
}, {
key: "renderCustomInputs",
value: function renderCustomInputs() {
var placeholder = this.placeholder;
var format = this.props.format;
var elementFunctions = {
d: this.renderDay,
M: this.renderMonth,
y: this.renderYear,
h: this.renderHour,
H: this.renderHour,
m: this.renderMinute,
s: this.renderSecond,
a: this.renderAmPm
};
var allowMultipleInstances = typeof format !== 'undefined';
return _renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
}
}, {
key: "renderNativeInput",
value: function renderNativeInput() {
var _this$props10 = this.props,
disabled = _this$props10.disabled,
maxDate = _this$props10.maxDate,
minDate = _this$props10.minDate,
name = _this$props10.name,
nativeInputAriaLabel = _this$props10.nativeInputAriaLabel,
required = _this$props10.required;
var value = this.state.value;
return /*#__PURE__*/_react["default"].createElement(_NativeInput["default"], {
key: "time",
ariaLabel: nativeInputAriaLabel,
disabled: disabled,
maxDate: maxDate || defaultMaxDate,
minDate: minDate || defaultMinDate,
name: name,
onChange: this.onChangeNative,
required: required,
value: value,
valueType: this.valueType
});
}
}, {
key: "render",
value: function render() {
var className = this.props.className;
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
return /*#__PURE__*/_react["default"].createElement("div", {
className: className,
onClick: this.onClick
}, this.renderNativeInput(), this.renderCustomInputs());
}
}], [{

@@ -889,0 +889,0 @@ key: "getDerivedStateFromProps",

"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {

@@ -26,10 +28,11 @@ value: true

var _excluded = ["calendarClassName", "className", "maxDetail", "onChange", "value"],
_excluded2 = ["clockClassName", "className", "maxDetail", "onChange", "value"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -49,3 +52,3 @@

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -66,7 +69,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

@@ -150,2 +153,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

if (openWidgetsOnFocus) {
if (event.target.getAttribute('data-select') === 'true') {
return;
}
switch (event.target.name) {

@@ -259,2 +266,7 @@ case 'day':

}, {
key: "eventProps",
get: function get() {
return (0, _makeEventProps["default"])(this.props);
}
}, {
key: "handleOutsideActionListeners",

@@ -385,3 +397,3 @@ value: function handleOutsideActionListeners(shouldListen) {

value = _this$props4.value,
calendarProps = _objectWithoutProperties(_this$props4, ["calendarClassName", "className", "maxDetail", "onChange", "value"]);
calendarProps = _objectWithoutProperties(_this$props4, _excluded);

@@ -413,3 +425,3 @@ var className = "".concat(baseClassName, "__calendar");

value = _this$props5.value,
clockProps = _objectWithoutProperties(_this$props5, ["clockClassName", "className", "maxDetail", "onChange", "value"]);
clockProps = _objectWithoutProperties(_this$props5, _excluded2);

@@ -456,7 +468,2 @@ var className = "".concat(baseClassName, "__clock");

}
}, {
key: "eventProps",
get: function get() {
return (0, _makeEventProps["default"])(this.props);
}
}], [{

@@ -463,0 +470,0 @@ key: "getDerivedStateFromProps",

@@ -19,3 +19,3 @@ "use strict";

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -22,0 +22,0 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

{
"name": "react-datetime-picker",
"version": "3.4.0",
"version": "3.4.1",
"description": "A date range picker for your React app.",

@@ -19,15 +19,2 @@ "main": "dist/entry.js",

},
"jest": {
"setupFiles": [
"<rootDir>/jest.setup.js"
],
"collectCoverageFrom": [
"**/src/**.{js,jsx}",
"!**/src/entry.js",
"!**/src/entry.nostyle.js"
],
"testPathIgnorePatterns": [
"utils.js"
]
},
"keywords": [

@@ -56,12 +43,11 @@ "calendar",

"react-clock": "^3.0.0",
"react-date-picker": "^8.3.2",
"react-date-picker": "^8.3.3",
"react-fit": "^1.0.3",
"react-time-picker": "^4.4.1"
"react-time-picker": "^4.4.2"
},
"devDependencies": {
"@babel/cli": "^7.8.0",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.0",
"@babel/cli": "^7.15.0",
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.0",

@@ -72,3 +58,3 @@ "babel-eslint": "^10.0.0",

"eslint-config-wojtekmaj": "^0.5.0",
"jest": "^26.6.0",
"jest": "^27.0.0",
"less": "^4.0.0",

@@ -75,0 +61,0 @@ "react": "^17.0.0",

@@ -132,2 +132,6 @@ import React, { PureComponent } from 'react';

if (openWidgetsOnFocus) {
if (event.target.getAttribute('data-select') === 'true') {
return;
}
switch (event.target.name) {

@@ -134,0 +138,0 @@ case 'day':

@@ -374,2 +374,20 @@ import React from 'react';

});
it('does not open Calendar component when focusing on a select element', () => {
const component = mount(
<DateTimePicker format="dd.MMMM.yyyy hh:mm:ss a" />,
);
const calendar = component.find('Calendar');
const select = component.find('select[name="month"]');
expect(calendar).toHaveLength(0);
select.simulate('focus');
component.update();
const calendar2 = component.find('Calendar');
expect(calendar2).toHaveLength(0);
});
});

@@ -431,2 +449,20 @@

});
it('does not open Clock component when focusing on a select element', () => {
const component = mount(
<DateTimePicker format="dd.MMMM.yyyy hh:mm:ss a" />,
);
const clock = component.find('Clock');
const select = component.find('select[name="amPm"]');
expect(clock).toHaveLength(0);
select.simulate('focus');
component.update();
const clock2 = component.find('Clock');
expect(clock2).toHaveLength(0);
});
});

@@ -433,0 +469,0 @@

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