Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_getMaxDate() {
const { rangeLimit, maxDate } = this.props
// TODO: simplify with FC approach, remove state logic from child components
// this is passed from the parent component
// @ts-ignore
const calcEndDate = addDays(this._selectionStart, rangeLimit as number)
if (maxDate) {
const isCalcEndDayBefore = isBefore(calcEndDate, maxDate)
return isCalcEndDayBefore ? calcEndDate : maxDate
} else {
return calcEndDate
}
}
this.currentWeek = []
// current day is sunday
if (currentDayOfWeek === 0) {
this.currentWeek.push(this.currentDay)
for (let i = 1; i < 7; i++) {
this.currentWeek.push(addDays(this.currentDay, i))
}
} else {
// the days before currentDay in this week
for (let i = currentDayOfWeek; i >= 0; i--) {
this.currentWeek.push(subDays(this.currentDay, i))
}
// the days after currentDay in this week
for (let i = 0; i < 6 - currentDayOfWeek; i++) {
this.currentWeek.push(addDays(this.currentDay, i + 1))
}
}
}
expiresOn: args => addDays(new Date(), args.remember ? 30 : 1),
field: "loginSecurityUser"
return range(7).map((val, index) => addDays(startDay, index))
}
<select placeholder="Select a color" multiple="" label="Leaf color" name="leafColor">
</select>
getAllDays(date) {
this.dayRowArr = [];
let start = startOfMonth(date);
let end = lastDayOfMonth(date);
start = addDays(startOfMonth(date), -getDay(start));
end = addDays(lastDayOfMonth(date), 6 - getDay(end));
let tempDate = start;
while (!isAfter(tempDate, end)) {
const rowArr = [];
for (let i = 0; i < 7; ++i) {
rowArr.push({
day: getDate(tempDate),
date: tempDate,
disabled: !inDateRange(tempDate, this.dateRange),
});
tempDate = addDays(tempDate, 1);
}
this.dayRowArr.push(rowArr);
}
},
addMonth(monthGap) {
maxPickableDate () {
return isInteger(this.maxDate)
? addDays(Date.now(), this.maxDate)
: this.maxDate
},
weekDays () {
const dates = new Array(7 * 6).fill(0).map((_, i) => addDays(firstDateOfCalendar, i));
const blockMonth = [];
for (let i = 0; i < daysInMonthWithFirstAndLastWeek + 1; i++) {
const day = addDays(startOfMonthStartOfWeek, i);
const dayKey = format(day, 'MM-D');
const clsDay = cx('rc-Day', {
'rc-Day--outside': isBefore(day, startOfMonth(date)) ||
isAfter(day, endOfMonth(date)),
});
blockMonth.push(
<div>
{format(addDays(startOfMonthStartOfWeek, i), [dayFormat])}
</div>
);
}
return blockMonth;
}