Skip to content

Commit

Permalink
Fix errors in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Oct 27, 2018
1 parent 247c909 commit 359ee06
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CenturyView/__tests__/Decade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Decade from '../Decade';
/* eslint-disable comma-dangle, jsx-a11y/mouse-events-have-key-events */

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],
date: new Date(2011, 0, 1),
point: 2011,
Expand Down
1 change: 1 addition & 0 deletions src/DecadeView/__tests__/Year.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Year from '../Year';
/* eslint-disable comma-dangle, jsx-a11y/mouse-events-have-key-events */

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],
date: new Date(2018, 0, 1),
point: 2018,
Expand Down
1 change: 1 addition & 0 deletions src/MonthView/__tests__/Day.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Day from '../Day';
/* eslint-disable comma-dangle, jsx-a11y/mouse-events-have-key-events */

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],
currentMonthIndex: 0,
date: new Date(2018, 0, 1),
Expand Down
1 change: 1 addition & 0 deletions src/YearView/__tests__/Month.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Month from '../Month';
/* eslint-disable comma-dangle, jsx-a11y/mouse-events-have-key-events */

const tileProps = {
activeStartDate: new Date(2018, 0, 1),
classes: ['react-calendar__tile'],
date: new Date(2018, 0, 1),
};
Expand Down
3 changes: 2 additions & 1 deletion src/shared/dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ export const getRange = (rangeType, date) => {
* @param {Date} date2 Second date.
*/
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 [
getBegin(rangeType, rawNextValue[0]),
getEnd(rangeType, rawNextValue[1]),
Expand Down

0 comments on commit 359ee06

Please sign in to comment.