mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/15603
This commit is contained in:
parent
65fd1fafc9
commit
e451c1f60a
1 changed files with 14 additions and 0 deletions
|
|
@ -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 {
|
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)
|
valueTime := time.UnixMilli(valueMills)
|
||||||
|
|
||||||
|
if otherValueStart.After(otherValueStart2) {
|
||||||
|
tmpStart, tmpEnd := otherValueStart2, otherValueEnd2
|
||||||
|
otherValueStart2, otherValueEnd2 = otherValueStart, otherValueEnd
|
||||||
|
otherValueStart, otherValueEnd = tmpStart, tmpEnd
|
||||||
|
}
|
||||||
|
|
||||||
switch operator {
|
switch operator {
|
||||||
case FilterOperatorIsEqual:
|
case FilterOperatorIsEqual:
|
||||||
return (valueTime.After(otherValueStart) || valueTime.Equal(otherValueStart)) && valueTime.Before(otherValueEnd)
|
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 {
|
func filterTime(valueMills int64, valueIsNotEmpty bool, otherValueMills, otherValueMills2 int64, operator FilterOperator) bool {
|
||||||
valueTime := time.UnixMilli(valueMills)
|
valueTime := time.UnixMilli(valueMills)
|
||||||
|
|
||||||
|
if 0 != otherValueMills2 && otherValueMills > otherValueMills2 {
|
||||||
|
tmp := otherValueMills2
|
||||||
|
otherValueMills2 = otherValueMills
|
||||||
|
otherValueMills = tmp
|
||||||
|
}
|
||||||
|
|
||||||
otherValueTime := time.UnixMilli(otherValueMills)
|
otherValueTime := time.UnixMilli(otherValueMills)
|
||||||
otherValueStart := time.Date(otherValueTime.Year(), otherValueTime.Month(), otherValueTime.Day(), 0, 0, 0, 0, otherValueTime.Location())
|
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())
|
otherValueEnd := time.Date(otherValueTime.Year(), otherValueTime.Month(), otherValueTime.Day(), 23, 59, 59, 999999999, otherValueTime.Location())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue