From 6f31b0990d3d0439cd71bda70fc83b4fe4cbbb2d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 25 Feb 2026 16:08:15 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/16963 Signed-off-by: Daniel <845765@qq.com> --- kernel/av/filter.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/kernel/av/filter.go b/kernel/av/filter.go index 52d185f81..16fe4df4d 100644 --- a/kernel/av/filter.go +++ b/kernel/av/filter.go @@ -978,10 +978,10 @@ func calcRelativeTimeRegion(count int, unit RelativeDateUnit, direction Relative // 结束时间:本周的周日 end = time.Date(now.Year(), now.Month(), now.Day()-weekday+7, 23, 59, 59, 999999999, now.Location()) case RelativeDateDirectionAfter: - // 开始时间:本周的周日 - start = time.Date(now.Year(), now.Month(), now.Day()-weekday+7, 23, 59, 59, 999999999, now.Location()) - // 结束时间:开始时间加上 count*7 天 - end = start.AddDate(0, 0, count*7) + // 开始时间:本周的周一加上 count*7 天 + start = time.Date(now.Year(), now.Month(), now.Day()-weekday+1, 0, 0, 0, 0, now.Location()).AddDate(0, 0, count*7) + // 结束时间:开始时间的周日 + end = time.Date(start.Year(), start.Month(), start.Day()-int(start.Weekday())+7, 23, 59, 59, 999999999, now.Location()) } case RelativeDateUnitMonth: switch direction { @@ -996,10 +996,10 @@ func calcRelativeTimeRegion(count int, unit RelativeDateUnit, direction Relative // 结束时间:下个月的 1 号减去 1 纳秒 end = time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) case RelativeDateDirectionAfter: - // 开始时间:下个月的 1 号减去 1 纳秒 - start = time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) - // 结束时间:开始时间加上 count 个月 - end = start.AddDate(0, count, 0) + // 开始时间:count 个月后的 1 号 + start = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()).AddDate(0, count, 0) + // 结束时间:开始时间的下个月的 1 号减去 1 纳秒 + end = time.Date(start.Year(), start.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) } case RelativeDateUnitYear: switch direction { @@ -1014,10 +1014,10 @@ func calcRelativeTimeRegion(count int, unit RelativeDateUnit, direction Relative // 结束时间:明年的 1 月 1 号减去 1 纳秒 end = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) case RelativeDateDirectionAfter: - // 开始时间:今年的 12 月 31 号 - start = time.Date(now.Year(), 12, 31, 23, 59, 59, 999999999, now.Location()) - // 结束时间:开始时间加上 count 年 - end = start.AddDate(count, 0, 0) + // 开始时间:count 年后的 1 月 1 号 + start = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, now.Location()).AddDate(count, 0, 0) + // 结束时间:开始时间的 count+1 年的 1 月 1 号减去 1 纳秒 + end = time.Date(start.Year()+1, 1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) } } return