mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
fix shifting date range bug when date range crosses one year
This commit is contained in:
+1
-1
@@ -156,7 +156,7 @@ function getShiftedDateRange(minTime, maxTime, scale) {
|
||||
const lastDayOfMonth = maxDateTime.clone().endOf('month');
|
||||
|
||||
if (firstDayOfMonth.unix() === minDateTime.unix() && lastDayOfMonth.unix() === maxDateTime.unix()) {
|
||||
const months = getMonth(maxDateTime) - getMonth(minDateTime) + 1;
|
||||
const months = getYear(maxDateTime) * 12 + getMonth(maxDateTime) - getYear(minDateTime) * 12 - getMonth(minDateTime) + 1;
|
||||
const newMinDateTime = minDateTime.add(months * scale, 'months');
|
||||
const newMaxDateTime = newMinDateTime.clone().add(months, 'months').subtract(1, 'seconds');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user