Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DATE_FORMAT
)
)
if (!from) {
const earliestTransactionDate = getEarliestDate(
...Object.keys(transactionsByDate)
)
from = isDateValid(earliestTransactionDate) ? earliestTransactionDate : to
}
const balances = {}
for (
let day = to, balance = getAccountBalance(account);
isDateAfter(day, from) || isDateEqual(day, from);
day = subDays(day, 1)
) {
const date = formatDate(day, DATE_FORMAT)
const transactions = transactionsByDate[date]
balance = transactions
? balance - sumBy(transactions, t => t.amount)
: balance
balances[date] = balance
}
return balances
}
protected weekChanged(week) {
if (
isWithinInterval(week, { start: this.minDate, end: this.maxDate }) ||
isWithinInterval(endOfWeek(week), { start: this.minDate, end: this.maxDate })
) {
this.start = isBefore(week, this.minDate) ? this.minDate : week;
this.end = isAfter(endOfWeek(week), this.maxDate) ? this.maxDate : endOfWeek(week);
this.startVm.currentMonth = startOfMonth(this.start);
this.endVm.currentMonth = startOfMonth(this.end);
}
}
UIDateRange.prototype.weekChanged = function (week) {
if (isWithinInterval(week, { start: this.minDate, end: this.maxDate }) ||
isWithinInterval(endOfWeek(week), { start: this.minDate, end: this.maxDate })) {
this.start = isBefore(week, this.minDate) ? this.minDate : week;
this.end = isAfter(endOfWeek(week), this.maxDate) ? this.maxDate : endOfWeek(week);
this.startVm.currentMonth = startOfMonth(this.start);
this.endVm.currentMonth = startOfMonth(this.end);
}
};
UIDateRange.prototype.startMonthChanged = function (month) {
return false;
}
}
}
if (isValid && this.disabledDays && this.disabledDays.length) {
let weekdayNum = getDay(value);
isValid = this.disabledDays.indexOf(weekdayNum) === -1;
}
if (isValid && this.min) {
isValid = isValid && !isBefore(value, this.min);
}
if (isValid && this.max) {
isValid = isValid && !isAfter(value, this.max);
}
return isValid;
}
protected dateChanged(date): void {
if (date && !this.ignoreChange) {
this.ignoreChange = true;
if (isBefore(date, this.minDate)) {
date = toDate(this.minDate);
}
if (isAfter(date, this.maxDate)) {
date = toDate(this.maxDate);
}
if (!this.isDateDisabled(date)) {
this.date = toDate(date);
this.time = toDate(this.date);
this.currentYear = getYear(this.date);
if (
!isSameMonth(
format(this.currentMonth, FORMAT_NO_TIMEZONE),
format(this.date, FORMAT_NO_TIMEZONE)
)
) {
this.currentMonth = startOfMonth(this.date);
}
}
const inHoverRange = (day: Date) => {
return (startDate &&
!endDate &&
hoverDay &&
isAfter(hoverDay, startDate) &&
isWithinRange(day, startDate, hoverDay)) as boolean;
};
isDisabled(day, start, end) {
return dateFns.isBefore(day, start) || dateFns.isAfter(day, end);
}
return date => isAfter(date, SIX_MONTHS_AGO)
}