Skip to content

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

:bug: When "Default fill created time" is enabled for database date fields, the automatically filled time value is incorrect https://github.com/siyuan-note/siyuan/issues/15684

Daniel4fd57efd68ba
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 12bf969651..374c6fa1dd 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -154,6 +154,10 @@ func getAttrViewAddingBlockDefaultValues(attrView *av.AttributeView, view, group
nearValue := getNewValueByNearItem(nearItem, keyValues.Key, addingItemID)
newValue.Date.IsNotTime = nearValue.Date.IsNotTime
}
+
+ if nil != keyValues.Key.Date && keyValues.Key.Date.AutoFillNow {
+ newValue.Date.Content = time.Now().UnixMilli()
+ }
}
ret[keyValues.Key.ID] = newValue
@@ -219,7 +223,12 @@ func getAttrViewAddingBlockDefaultValues(attrView *av.AttributeView, view, group
if nil != nearItem && filterKeyIDs[groupKey.ID] {
// 临近项不为空并且分组字段和过滤字段相同时,优先使用临近项 https://github.com/siyuan-note/siyuan/issues/15591
- ret[groupKey.ID] = getNewValueByNearItem(nearItem, groupKey, addingItemID)
+ newValue = getNewValueByNearItem(nearItem, groupKey, addingItemID)
+ ret[groupKey.ID] = newValue
+
+ if nil != keyValues.Key.Date && keyValues.Key.Date.AutoFillNow {
+ newValue.Date.Content = time.Now().UnixMilli()
+ }
return
}
@@ -254,6 +263,10 @@ func getAttrViewAddingBlockDefaultValues(attrView *av.AttributeView, view, group
if nil != newValue && !filterKeyIDs[groupKey.ID] {
ret[groupKey.ID] = newValue
+
+ if nil != keyValues.Key.Date && keyValues.Key.Date.AutoFillNow {
+ newValue.Date.Content = time.Now().UnixMilli()
+ }
}
return
}