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

availity-reactstrap-validation

Package Overview
Dependencies
Maintainers
7
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

availity-reactstrap-validation - npm Package Compare versions

Comparing version 2.5.2 to 2.5.3

15

CHANGELOG.md

@@ -0,1 +1,16 @@

<a name="2.5.3"></a>
## [2.5.3](https://github.com/Availity/availity-reactstrap-validation/compare/2.5.2...2.5.3) (2019-05-16)
### Code Refactoring
* replaced moment with dayjs ([f5a9ffa](https://github.com/Availity/availity-reactstrap-validation/commit/f5a9ffa))
### BREAKING CHANGES
* moment has been replaced
<a name="2.5.2"></a>

@@ -2,0 +17,0 @@ ## [2.5.2](https://github.com/Availity/availity-reactstrap-validation/compare/2.5.0...2.5.2) (2019-04-26)

20

lib/AvValidator/date.js

@@ -6,6 +6,10 @@ 'use strict';

var _moment = require('moment');
var _dayjs = require('dayjs');
var _moment2 = _interopRequireDefault(_moment);
var _dayjs2 = _interopRequireDefault(_dayjs);
var _customParseFormat = require('dayjs/plugin/customParseFormat');
var _customParseFormat2 = _interopRequireDefault(_customParseFormat);
var _utils = require('./utils');

@@ -15,6 +19,10 @@

_dayjs2.default.extend(_customParseFormat2.default);
var defaultFormat = 'MM/DD/YYYY';
function validate(value, context) {
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref$format = _ref.format,
format = _ref$format === undefined ? 'MM/DD/YYYY' : _ref$format,
format = _ref$format === undefined ? defaultFormat : _ref$format,
_ref$errorMessage = _ref.errorMessage,

@@ -25,5 +33,9 @@ errorMessage = _ref$errorMessage === undefined ? 'Format needs to be ' + format : _ref$errorMessage;

var date = (0, _moment2.default)(value, [_utils.isoDateFormat, format], true);
var date = (0, _dayjs2.default)(value, format);
if (format === defaultFormat && !date.isValid()) {
date = (0, _dayjs2.default)(value, _utils.isoDateFormat);
}
return date.isValid() || errorMessage;
}

31

lib/AvValidator/dateRange.js

@@ -6,6 +6,14 @@ 'use strict';

var _moment = require('moment');
var _dayjs = require('dayjs');
var _moment2 = _interopRequireDefault(_moment);
var _dayjs2 = _interopRequireDefault(_dayjs);
var _isBetween = require('dayjs/plugin/isBetween');
var _isBetween2 = _interopRequireDefault(_isBetween);
var _customParseFormat = require('dayjs/plugin/customParseFormat');
var _customParseFormat2 = _interopRequireDefault(_customParseFormat);
var _utils = require('./utils');

@@ -15,2 +23,5 @@

_dayjs2.default.extend(_isBetween2.default);
_dayjs2.default.extend(_customParseFormat2.default);
function setMin(value) {

@@ -33,7 +44,7 @@ value.set('hours', 0);

function getStartDate(start) {
return setMin((0, _moment2.default)().add(start.value, start.units));
return setMin((0, _dayjs2.default)().add(start.value, start.units));
}
function getEndDate(end) {
return setMax((0, _moment2.default)().add(end.value, end.units));
return setMax((0, _dayjs2.default)().add(end.value, end.units));
}

@@ -58,5 +69,9 @@

var date = (0, _moment2.default)(value, [_utils.isoDateFormat, format], true);
setMin(date);
var date = (0, _dayjs2.default)(value, format);
if (!date.isValid()) {
date = (0, _dayjs2.default)(value, _utils.isoDateFormat);
}
date = setMin(date);
if (!(0, _utils.isEmpty)(start.units) && !(0, _utils.isEmpty)(end.units)) {

@@ -66,4 +81,4 @@ startDate = getStartDate(start);

} else {
startDate = (0, _moment2.default)(start.value, start.format || format);
endDate = setMax((0, _moment2.default)(end.value, end.format || format));
startDate = (0, _dayjs2.default)(start.value, start.format || format);
endDate = setMax((0, _dayjs2.default)(end.value, end.format || format));
}

@@ -70,0 +85,0 @@ errorMessage = errorMessage || 'Date must be between ' + startDate.format(displayFormat) + ' and ' + endDate.format(displayFormat);

@@ -6,6 +6,10 @@ 'use strict';

var _moment = require('moment');
var _dayjs = require('dayjs');
var _moment2 = _interopRequireDefault(_moment);
var _dayjs2 = _interopRequireDefault(_dayjs);
var _isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
var _isSameOrBefore2 = _interopRequireDefault(_isSameOrBefore);
var _toNumber = require('lodash/toNumber');

@@ -23,2 +27,4 @@

_dayjs2.default.extend(_isSameOrBefore2.default);
function validate(value, context) {

@@ -35,3 +41,3 @@ var constraint = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

if (input.validations && input.validations.date || input.props && input.props.type && input.props.type.toLowerCase() === 'date') {
return (0, _moment2.default)(value, [_utils.isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrBefore(constraint.value, 'day') || constraint.errorMessage || false;
return (0, _dayjs2.default)(value, [_utils.isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrBefore(constraint.value, 'day') || constraint.errorMessage || false;
}

@@ -38,0 +44,0 @@

@@ -6,6 +6,10 @@ 'use strict';

var _moment = require('moment');
var _dayjs = require('dayjs');
var _moment2 = _interopRequireDefault(_moment);
var _dayjs2 = _interopRequireDefault(_dayjs);
var _isSameOrAfter = require('dayjs/plugin/isSameOrAfter');
var _isSameOrAfter2 = _interopRequireDefault(_isSameOrAfter);
var _toNumber = require('lodash/toNumber');

@@ -23,2 +27,4 @@

_dayjs2.default.extend(_isSameOrAfter2.default);
function validate(value, context) {

@@ -35,3 +41,3 @@ var constraint = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

if (input.validations && input.validations.date || input.props && input.props.type && input.props.type.toLowerCase() === 'date') {
return (0, _moment2.default)(value, [_utils.isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrAfter(constraint.value, 'day') || constraint.errorMessage || false;
return (0, _dayjs2.default)(value, [_utils.isoDateFormat, constraint.format || 'MM/DD/YYYY'], true).isSameOrAfter(constraint.value, 'day') || constraint.errorMessage || false;
}

@@ -38,0 +44,0 @@

{
"name": "availity-reactstrap-validation",
"version": "2.5.2",
"version": "2.5.3",
"author": "Evan Sharp <evan.sharp@availity.com>",

@@ -59,4 +59,4 @@ "description": "Form validation helpers for reactstrap",

"classnames": "^2.2.6",
"dayjs": "^1.8.13",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"prop-types": "^15.6.2"

@@ -63,0 +63,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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