mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 Database grouping by field https://github.com/siyuan-note/siyuan/issues/10964
This commit is contained in:
parent
cbbca634f5
commit
2eadefed6f
1 changed files with 4 additions and 5 deletions
|
|
@ -1634,17 +1634,18 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
||||||
// 过去 30 天、过去 7 天、昨天、今天、明天、未来 7 天、未来 30 天
|
// 过去 30 天、过去 7 天、昨天、今天、明天、未来 7 天、未来 30 天
|
||||||
// 未来 30 天之后的按月分组
|
// 未来 30 天之后的按月分组
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
now = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
|
||||||
if contentTime.Before(now.AddDate(0, 0, -30)) {
|
if contentTime.Before(now.AddDate(0, 0, -30)) {
|
||||||
groupName = contentTime.Format("2006-01")
|
groupName = contentTime.Format("2006-01")
|
||||||
} else if contentTime.Before(now.AddDate(0, 0, -7)) {
|
} else if contentTime.Before(now.AddDate(0, 0, -7)) {
|
||||||
groupName = groupNameLast30Days
|
groupName = groupNameLast30Days
|
||||||
} else if contentTime.Before(now.AddDate(0, 0, -1)) {
|
} else if contentTime.Before(now.AddDate(0, 0, -1)) {
|
||||||
groupName = groupNameLast7Days
|
groupName = groupNameLast7Days
|
||||||
} else if contentTime.Equal(now.AddDate(0, 0, -1)) {
|
} else if contentTime.Before(now) {
|
||||||
groupName = groupNameYesterday
|
groupName = groupNameYesterday
|
||||||
} else if contentTime.Equal(now) {
|
} else if contentTime.After(now) && contentTime.Before(now.AddDate(0, 0, 1)) {
|
||||||
groupName = groupNameToday
|
groupName = groupNameToday
|
||||||
} else if contentTime.Equal(now.AddDate(0, 0, 1)) {
|
} else if contentTime.After(now.AddDate(0, 0, 1)) || contentTime.Equal(now.AddDate(0, 0, 1)) {
|
||||||
groupName = groupNameTomorrow
|
groupName = groupNameTomorrow
|
||||||
} else if contentTime.After(now.AddDate(0, 0, 30)) {
|
} else if contentTime.After(now.AddDate(0, 0, 30)) {
|
||||||
groupName = contentTime.Format("2006-01")
|
groupName = contentTime.Format("2006-01")
|
||||||
|
|
@ -1652,8 +1653,6 @@ func genAttrViewViewGroups(view *av.View, attrView *av.AttributeView) {
|
||||||
groupName = groupNameNext30Days
|
groupName = groupNameNext30Days
|
||||||
} else if contentTime.After(now.AddDate(0, 0, 1)) {
|
} else if contentTime.After(now.AddDate(0, 0, 1)) {
|
||||||
groupName = groupNameNext7Days
|
groupName = groupNameNext7Days
|
||||||
} else {
|
|
||||||
groupName = notInRange
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue