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

react-calendar

Package Overview
Dependencies
Maintainers
3
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-calendar - npm Package Compare versions

Comparing version 2.17.4 to 2.17.5

83

dist/Calendar/Navigation.js

@@ -31,4 +31,4 @@ 'use strict';

var Navigation = function (_Component) {
_inherits(Navigation, _Component);
var Navigation = function (_PureComponent) {
_inherits(Navigation, _PureComponent);

@@ -78,25 +78,14 @@ function Navigation() {

_createClass(Navigation, [{
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps) {
var _props = this.props,
activeStartDate = _props.activeStartDate,
locale = _props.locale,
view = _props.view;
return nextProps.activeStartDate !== activeStartDate || nextProps.locale !== locale || nextProps.view !== view;
}
}, {
key: 'render',
value: function render() {
var label = this.label;
var _props2 = this.props,
date = _props2.activeStartDate,
drillUp = _props2.drillUp,
navigationLabel = _props2.navigationLabel,
next2Label = _props2.next2Label,
nextLabel = _props2.nextLabel,
prev2Label = _props2.prev2Label,
prevLabel = _props2.prevLabel,
view = _props2.view;
var _props = this.props,
date = _props.activeStartDate,
drillUp = _props.drillUp,
navigationLabel = _props.navigationLabel,
next2Label = _props.next2Label,
nextLabel = _props.nextLabel,
prev2Label = _props.prev2Label,
prevLabel = _props.prevLabel,
view = _props.view;

@@ -168,5 +157,5 @@

get: function get() {
var _props3 = this.props,
view = _props3.view,
views = _props3.views;
var _props2 = this.props,
view = _props2.view,
views = _props2.views;

@@ -178,6 +167,6 @@ return views.indexOf(view) > 0;

get: function get() {
var _props4 = this.props,
date = _props4.activeStartDate,
minDate = _props4.minDate,
view = _props4.view;
var _props3 = this.props,
date = _props3.activeStartDate,
minDate = _props3.minDate,
view = _props3.view;

@@ -194,6 +183,6 @@ var previousActiveStartDate = (0, _dates.getBeginPrevious)(view, date);

get: function get() {
var _props5 = this.props,
date = _props5.activeStartDate,
minDate = _props5.minDate,
view = _props5.view;
var _props4 = this.props,
date = _props4.activeStartDate,
minDate = _props4.minDate,
view = _props4.view;

@@ -210,6 +199,6 @@ var previousActiveStartDate = (0, _dates.getBeginPrevious2)(view, date);

get: function get() {
var _props6 = this.props,
date = _props6.activeStartDate,
maxDate = _props6.maxDate,
view = _props6.view;
var _props5 = this.props,
date = _props5.activeStartDate,
maxDate = _props5.maxDate,
view = _props5.view;

@@ -222,6 +211,6 @@ var nextActiveStartDate = (0, _dates.getBeginNext)(view, date);

get: function get() {
var _props7 = this.props,
date = _props7.activeStartDate,
maxDate = _props7.maxDate,
view = _props7.view;
var _props6 = this.props,
date = _props6.activeStartDate,
maxDate = _props6.maxDate,
view = _props6.view;

@@ -234,7 +223,7 @@ var nextActiveStartDate = (0, _dates.getBeginNext2)(view, date);

get: function get() {
var _props8 = this.props,
date = _props8.activeStartDate,
formatMonthYear = _props8.formatMonthYear,
locale = _props8.locale,
view = _props8.view;
var _props7 = this.props,
date = _props7.activeStartDate,
formatMonthYear = _props7.formatMonthYear,
locale = _props7.locale,
view = _props7.view;

@@ -258,3 +247,3 @@

return Navigation;
}(_react.Component);
}(_react.PureComponent);

@@ -261,0 +250,0 @@ exports.default = Navigation;

@@ -486,4 +486,7 @@ 'use strict';

var getValueRange = exports.getValueRange = function getValueRange(rangeType, date1, date2) {
var rawNextValue = [date1, date2].sort(function (a, b) {
return a.getTime() > b.getTime();
// Need to change to number and back due to https://bugs.chromium.org/p/v8/issues/detail?id=8379
var rawNextValue = [date1, date2].map(function (d) {
return d.getTime();
}).sort().map(function (d) {
return new Date(d);
});

@@ -490,0 +493,0 @@ return [getBegin(rangeType, rawNextValue[0]), getEnd(rangeType, rawNextValue[1])];

{
"name": "react-calendar",
"version": "2.17.4",
"version": "2.17.5",
"description": "Ultimate calendar for your React app.",

@@ -5,0 +5,0 @@ "main": "dist/entry.js",

@@ -393,2 +393,26 @@ import React from 'react';

it('disallows navigating before dynamically set minDate', () => {
const component = shallow(
<Navigation
activeStartDate={new Date(2017, 0, 1)}
drillUp={jest.fn()}
setActiveStartDate={jest.fn()}
view="month"
views={allViews}
/>
);
component.setProps({
minDate: new Date(2017, 0, 1),
});
const arrows = component.find('button.react-calendar__navigation__arrow');
const prev2 = arrows.at(0);
const prev = arrows.at(1);
expect(prev2.prop('disabled')).toBeTruthy();
expect(prev.prop('disabled')).toBeTruthy();
});
it('disallows navigating after maxDate', () => {

@@ -415,2 +439,26 @@ const component = shallow(

it('disallows navigating after dynamically set maxDate', () => {
const component = shallow(
<Navigation
activeStartDate={new Date(2017, 0, 1)}
drillUp={jest.fn()}
setActiveStartDate={jest.fn()}
view="month"
views={allViews}
/>
);
component.setProps({
maxDate: new Date(2017, 0, 31),
});
const arrows = component.find('button.react-calendar__navigation__arrow');
const next = arrows.at(2);
const next2 = arrows.at(3);
expect(next.prop('disabled')).toBeTruthy();
expect(next2.prop('disabled')).toBeTruthy();
});
it('disallows navigating before the year 1000', () => {

@@ -417,0 +465,0 @@ const component = shallow(

@@ -1,2 +0,2 @@

import React, { Component } from 'react';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

@@ -18,13 +18,3 @@

export default class Navigation extends Component {
shouldComponentUpdate(nextProps) {
const { activeStartDate, locale, view } = this.props;
return (
nextProps.activeStartDate !== activeStartDate
|| nextProps.locale !== locale
|| nextProps.view !== view
);
}
export default class Navigation extends PureComponent {
get drillUpAvailable() {

@@ -31,0 +21,0 @@ const { view, views } = this.props;

@@ -9,2 +9,3 @@ import React from 'react';

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],

@@ -11,0 +12,0 @@ date: new Date(2011, 0, 1),

@@ -9,2 +9,3 @@ import React from 'react';

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],

@@ -11,0 +12,0 @@ date: new Date(2018, 0, 1),

@@ -9,2 +9,3 @@ import React from 'react';

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],

@@ -11,0 +12,0 @@ currentMonthIndex: 0,

@@ -442,3 +442,4 @@ const [

export const getValueRange = (rangeType, date1, date2) => {
const rawNextValue = [date1, date2].sort((a, b) => a.getTime() > b.getTime());
// Need to change to number and back due to https://bugs.chromium.org/p/v8/issues/detail?id=8379
const rawNextValue = [date1, date2].map(d => d.getTime()).sort().map(d => new Date(d));
return [

@@ -445,0 +446,0 @@ getBegin(rangeType, rawNextValue[0]),

@@ -9,2 +9,3 @@ import React from 'react';

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],

@@ -11,0 +12,0 @@ date: new Date(2018, 0, 1),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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