mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
fix the date range may be incorrect when switching between fiscal years
This commit is contained in:
@@ -653,6 +653,18 @@ export function getShiftedDateRange(minTime: number, maxTime: number, scale: num
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check whether the date range matches one full year
|
||||||
|
if (minDateTime.clone().add(1, 'years').subtract(1, 'seconds').unix() === maxDateTime.unix() ||
|
||||||
|
maxDateTime.clone().subtract(1, 'years').add(1, 'seconds').unix() === minDateTime.unix()) {
|
||||||
|
const newMinDateTime = minDateTime.add(1 * scale, 'years');
|
||||||
|
const newMaxDateTime = maxDateTime.add(1 * scale, 'years');
|
||||||
|
|
||||||
|
return {
|
||||||
|
minTime: newMinDateTime.unix(),
|
||||||
|
maxTime: newMaxDateTime.unix()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// check whether the date range matches one full month
|
// check whether the date range matches one full month
|
||||||
if (minDateTime.clone().add(1, 'months').subtract(1, 'seconds').unix() === maxDateTime.unix() ||
|
if (minDateTime.clone().add(1, 'months').subtract(1, 'seconds').unix() === maxDateTime.unix() ||
|
||||||
maxDateTime.clone().subtract(1, 'months').add(1, 'seconds').unix() === minDateTime.unix()) {
|
maxDateTime.clone().subtract(1, 'months').add(1, 'seconds').unix() === minDateTime.unix()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user