Skip to content

Commit

Permalink
When counting today is enabled, move the balance row after current day (
Browse files Browse the repository at this point in the history
#584)

Closes #574
  • Loading branch information
thamara committed Nov 10, 2020
2 parents e963957 + 5daa7b8 commit a8ab380
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion js/classes/BaseCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class BaseCalendar
}

let balanceRowPosition = 0;
for (let day = 1; day < this._getTodayDate(); ++day)
const lastDay = this._getCountToday() ? this._getTodayDate() + 1 : this._getTodayDate();
for (let day = 1; day < lastDay; ++day)
{
if (this._showDay(this._getCalendarYear(), this._getCalendarMonth(), day))
{
Expand Down
7 changes: 6 additions & 1 deletion js/classes/FlexibleMonthCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ class FlexibleMonthCalendar extends BaseCalendar
let monthTotal = '00:00';
let workingDays = 0;
let stopCountingMonthStats = false;
let lastDateToCount = new Date(this._getCalendarYear(), this._getCalendarMonth(), this._getCalendarDate());
if (this._getCountToday())
{
lastDateToCount.setDate(lastDateToCount.getDate() + 1);
}
for (let day = 1; day <= monthLength; ++day)
{
if (!this._showDay(this._getCalendarYear(), this._getCalendarMonth(), day))
Expand All @@ -536,7 +541,7 @@ class FlexibleMonthCalendar extends BaseCalendar
this._colorErrorLine(dateKey);
}

stopCountingMonthStats |= (this._getTodayDate() === day && this._getTodayMonth() === this._getCalendarMonth() && this._getTodayYear() === this._getCalendarYear());
stopCountingMonthStats |= (lastDateToCount.getDate() === day && lastDateToCount.getMonth() === this._getCalendarMonth() && lastDateToCount.getFullYear() === this._getCalendarYear());
if (stopCountingMonthStats)
{
continue;
Expand Down

0 comments on commit a8ab380

Please sign in to comment.