Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve av https://github.com/siyuan-note/siyuan/issues/15603

Daniele451c1f60afd
diff --git a/kernel/av/filter.go b/kernel/av/filter.go
index ed0bb56359..1a689ceb85 100644
--- a/kernel/av/filter.go
+++ b/kernel/av/filter.go
@@ -558,6 +558,13 @@ func filterTextContent(operator FilterOperator, valueContent, otherValueContent
func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterOperator, otherValueStart, otherValueEnd time.Time, direction RelativeDateDirection, otherValueStart2, otherValueEnd2 time.Time, direction2 RelativeDateDirection) bool {
valueTime := time.UnixMilli(valueMills)
+
+ if otherValueStart.After(otherValueStart2) {
+ tmpStart, tmpEnd := otherValueStart2, otherValueEnd2
+ otherValueStart2, otherValueEnd2 = otherValueStart, otherValueEnd
+ otherValueStart, otherValueEnd = tmpStart, tmpEnd
+ }
+
switch operator {
case FilterOperatorIsEqual:
return (valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && valueTime.Before(otherValueEnd)
@@ -649,6 +656,13 @@ func filterRelativeTime(valueMills int64, valueIsNotEmpty bool, operator FilterO
func filterTime(valueMills int64, valueIsNotEmpty bool, otherValueMills, otherValueMills2 int64, operator FilterOperator) bool {
valueTime := time.UnixMilli(valueMills)
+
+ if 0 != otherValueMills2 && otherValueMills > otherValueMills2 {
+ tmp := otherValueMills2
+ otherValueMills2 = otherValueMills
+ otherValueMills = tmp
+ }
+
otherValueTime := time.UnixMilli(otherValueMills)
otherValueStart := time.Date(otherValueTime.Year(), otherValueTime.Month(), otherValueTime.Day(), 0, 0, 0, 0, otherValueTime.Location())
otherValueEnd := time.Date(otherValueTime.Year(), otherValueTime.Month(), otherValueTime.Day(), 23, 59, 59, 999999999, otherValueTime.Location())