Skip to content

Commit

Permalink
Merge 39544b9 into 89d321f
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauter001 authored Nov 17, 2023
2 parents 89d321f + 39544b9 commit d1d02af
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
20 changes: 10 additions & 10 deletions src/calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -861,18 +861,18 @@ export default class Calendar extends React.Component {
return;
}

var monthList = [];
var monthsToSubtract = this.props.showPreviousMonths
const monthList = [];
const monthsToSubtract = this.props.showPreviousMonths
? this.props.monthsShown - 1
: 0;
var fromMonthDate = subMonths(this.state.date, monthsToSubtract);
var monthSelectedIn = this.props.monthSelectedIn ?? monthsToSubtract;
for (var i = 0; i < this.props.monthsShown; ++i) {
var monthsToAdd = i - monthSelectedIn + monthsToSubtract;
var monthDate = addMonths(fromMonthDate, monthsToAdd);
var monthKey = `month-${i}`;
var monthShowsDuplicateDaysEnd = i < this.props.monthsShown - 1;
var monthShowsDuplicateDaysStart = i > 0;
const fromMonthDate = subMonths(this.state.date, monthsToSubtract);
const monthSelectedIn = this.props.monthSelectedIn ?? monthsToSubtract;
for (let i = 0; i < this.props.monthsShown; ++i) {
const monthsToAdd = i - monthSelectedIn + monthsToSubtract;
const monthDate = addMonths(fromMonthDate, monthsToAdd);
const monthKey = `month-${i}`;
const monthShowsDuplicateDaysEnd = i < this.props.monthsShown - 1;
const monthShowsDuplicateDaysStart = i > 0;
monthList.push(
<div
key={monthKey}
Expand Down
10 changes: 5 additions & 5 deletions src/date_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const DEFAULT_YEAR_ITEM_NUMBER = 12;

// This RegExp catches symbols escaped by quotes, and also
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;

// ** Date Constructors **

Expand Down Expand Up @@ -105,9 +105,9 @@ export function parseDate(value, dateFormat, locale, strictParsing, minDate) {
dateFormat = dateFormat
.match(longFormattingTokensRegExp)
.map(function (substring) {
var firstCharacter = substring[0];
const firstCharacter = substring[0];
if (firstCharacter === "p" || firstCharacter === "P") {
var longFormatter = longFormatters[firstCharacter];
const longFormatter = longFormatters[firstCharacter];
return localeObject
? longFormatter(substring, localeObject.formatLong)
: firstCharacter;
Expand Down Expand Up @@ -497,8 +497,8 @@ export function isQuarterDisabled(

/**
* @param {number} year
* @param {date} start
* @param {date} end
* @param {Date} start
* @param {Date} end
* @returns {boolean}
*/
export function isYearInRange(year, start, end) {
Expand Down
4 changes: 2 additions & 2 deletions src/month.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class Month extends React.Component {
fixedHeight: PropTypes.bool,
formatWeekNumber: PropTypes.func,
highlightDates: PropTypes.instanceOf(Map),
holidays: PropTypes.PropTypes.instanceOf(Map),
holidays: PropTypes.instanceOf(Map),
includeDates: PropTypes.array,
includeDateIntervals: PropTypes.array,
inline: PropTypes.bool,
Expand Down Expand Up @@ -592,7 +592,7 @@ export default class Month extends React.Component {
minDate,
maxDate,
preSelection,
disabledKeyboardNavigation
disabledKeyboardNavigation,
} = this.props;
return classnames(
"react-datepicker__quarter-text",
Expand Down
2 changes: 1 addition & 1 deletion src/year_dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import YearDropdownOptions from "./year_dropdown_options";
import onClickOutside from "react-onclickoutside";
import { getYear } from "./date_utils";

var WrappedYearDropdownOptions = onClickOutside(YearDropdownOptions);
const WrappedYearDropdownOptions = onClickOutside(YearDropdownOptions);

export default class YearDropdown extends React.Component {
static propTypes = {
Expand Down
10 changes: 5 additions & 5 deletions src/year_dropdown_options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import classNames from "classnames";
import { getYear } from "./date_utils";

function generateYears(year, noOfYear, minDate, maxDate) {
var list = [];
for (var i = 0; i < 2 * noOfYear + 1; i++) {
const list = [];
for (let i = 0; i < 2 * noOfYear + 1; i++) {
const newYear = year + noOfYear - i;
let isInRange = true;

Expand Down Expand Up @@ -73,8 +73,8 @@ export default class YearDropdownOptions extends React.Component {
}

renderOptions = () => {
var selectedYear = this.props.year;
var options = this.state.yearsList.map((year) => (
const selectedYear = this.props.year;
const options = this.state.yearsList.map((year) => (
<div
className={
selectedYear === year
Expand Down Expand Up @@ -133,7 +133,7 @@ export default class YearDropdownOptions extends React.Component {
};

shiftYears = (amount) => {
var years = this.state.yearsList.map(function (year) {
const years = this.state.yearsList.map(function (year) {
return year + amount;
});

Expand Down

0 comments on commit d1d02af

Please sign in to comment.