🐛 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

This commit is contained in:
Daniel 2025-08-28 17:02:21 +08:00
parent f0f15673f0
commit 4fd57efd68
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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
}