🐛 Date field does not respect end time switch when exporting database block https://github.com/siyuan-note/siyuan/issues/10409

This commit is contained in:
Daniel 2024-02-23 17:53:43 +08:00
parent 2b2aced238
commit d2dc9623a7
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 15 additions and 11 deletions

View file

@ -301,7 +301,7 @@ const (
DateFormatDuration DateFormat = "duration"
)
func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime bool) (ret *ValueDate) {
func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime, hasEndDate bool) (ret *ValueDate) {
var formatted string
contentTime := time.UnixMilli(content)
if 0 == content || contentTime.IsZero() {
@ -321,7 +321,7 @@ func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime
formatted = contentTime.Format("2006-01-02 15:04")
}
if 0 < content2 {
if hasEndDate {
var formattedContent2 string
content2Time := time.UnixMilli(content2)
if isNotTime {
@ -343,7 +343,7 @@ func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime
ret = &ValueDate{
Content: content,
Content2: content2,
HasEndDate: false,
HasEndDate: hasEndDate,
IsNotTime: true,
FormattedContent: formatted,
}