From 2b2aced2386899603948e202ba6cc6f5b1082656 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Fri, 23 Feb 2024 17:16:18 +0800
Subject: [PATCH 1/3] :arrow_up: Upgrade Electron v29.0.1 Fix
https://github.com/siyuan-note/siyuan/issues/10406
---
app/package.json | 2 +-
app/pnpm-lock.yaml | 24 ++++++++++++++++--------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/app/package.json b/app/package.json
index 9f6e85e95..b1df668f5 100644
--- a/app/package.json
+++ b/app/package.json
@@ -53,7 +53,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.1",
"dayjs": "^1.11.5",
- "electron": "28.2.1",
+ "electron": "29.0.1",
"electron-builder": "^24.9.1",
"encoding": "^0.1.13",
"esbuild-loader": "^3.0.1",
diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml
index e2eb85cd3..0199a064e 100644
--- a/app/pnpm-lock.yaml
+++ b/app/pnpm-lock.yaml
@@ -7,7 +7,7 @@ settings:
dependencies:
'@electron/remote':
specifier: ^2.1.2
- version: 2.1.2(electron@28.2.1)
+ version: 2.1.2(electron@29.0.1)
devDependencies:
'@types/node':
@@ -32,8 +32,8 @@ devDependencies:
specifier: ^1.11.5
version: 1.11.5
electron:
- specifier: 28.2.1
- version: 28.2.1
+ specifier: 29.0.1
+ version: 29.0.1
electron-builder:
specifier: ^24.9.1
version: 24.9.1
@@ -161,12 +161,12 @@ packages:
- supports-color
dev: true
- /@electron/remote@2.1.2(electron@28.2.1):
+ /@electron/remote@2.1.2(electron@29.0.1):
resolution: {integrity: sha512-EPwNx+nhdrTBxyCqXt/pftoQg/ybtWDW3DUWHafejvnB1ZGGfMpv6e15D8KeempocjXe78T7WreyGGb3mlZxdA==}
peerDependencies:
electron: '>= 13.0.0'
dependencies:
- electron: 28.2.1
+ electron: 29.0.1
dev: false
/@electron/universal@1.4.1:
@@ -582,6 +582,11 @@ packages:
/@types/node@18.13.0:
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
+ /@types/node@20.11.20:
+ resolution: {integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==}
+ dependencies:
+ undici-types: 5.26.5
+
/@types/plist@3.0.2:
resolution: {integrity: sha512-ULqvZNGMv0zRFvqn8/4LSPtnmN4MfhlPNtJCTpKuIIxGVGZ2rYWzFXrvEBoh9CVyqSE7D6YFRJ1hydLHI6kbWw==}
requiresBuild: true
@@ -1670,14 +1675,14 @@ packages:
resolution: {integrity: sha512-YoVeFrGd/7ROjz4R9uPoND1K/hSRC/xADy9639ZmIZeJSaBnKdYx3I6LMPsY7CXLpK7JFgKQVzeZ/dk2br6Eaw==}
dev: true
- /electron@28.2.1:
- resolution: {integrity: sha512-wlzXf+OvOiVlBf9dcSeMMf7Q+N6DG+wtgFbMK0sA/JpIJcdosRbLMQwLg/LTwNVKIbmayqFLDp4FmmFkEMhbYA==}
+ /electron@29.0.1:
+ resolution: {integrity: sha512-hsQr9clm8NCAMv4uhHlXThHn52UAgrHgyz3ubBAxZIPuUcpKVDtg4HPmx4hbmHIbYICI5OyLN3Ztp7rS+Dn4Lw==}
engines: {node: '>= 12.20.55'}
hasBin: true
requiresBuild: true
dependencies:
'@electron/get': 2.0.2
- '@types/node': 18.13.0
+ '@types/node': 20.11.20
extract-zip: 2.0.1
transitivePeerDependencies:
- supports-color
@@ -3638,6 +3643,9 @@ packages:
hasBin: true
dev: true
+ /undici-types@5.26.5:
+ resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
+
/universalify@0.1.2:
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
engines: {node: '>= 4.0.0'}
From d2dc9623a77202cc65668319823d113480e6069a Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Fri, 23 Feb 2024 17:53:43 +0800
Subject: [PATCH 2/3] :bug: Date field does not respect end time switch when
exporting database block https://github.com/siyuan-note/siyuan/issues/10409
---
kernel/av/table.go | 16 ++++++++++------
kernel/av/value.go | 6 +++---
kernel/model/export.go | 4 ++--
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/kernel/av/table.go b/kernel/av/table.go
index c38922c0a..d6c029a05 100644
--- a/kernel/av/table.go
+++ b/kernel/av/table.go
@@ -1298,50 +1298,54 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {
}
case CalcOperatorEarliest:
earliest := int64(0)
- var isNotTime bool
+ var isNotTime, hasEndDate bool
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {
if 0 == earliest || earliest > row.Cells[colIndex].Value.Date.Content {
earliest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
+ hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
}
}
if 0 != earliest {
- col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, 0, DateFormatNone, isNotTime)}
+ col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, 0, DateFormatNone, isNotTime, hasEndDate)}
}
case CalcOperatorLatest:
latest := int64(0)
- var isNotTime bool
+ var isNotTime, hasEndDate bool
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {
if 0 == latest || latest < row.Cells[colIndex].Value.Date.Content {
latest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
+ hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
}
}
if 0 != latest {
- col.Calc.Result = &Value{Date: NewFormattedValueDate(latest, 0, DateFormatNone, isNotTime)}
+ col.Calc.Result = &Value{Date: NewFormattedValueDate(latest, 0, DateFormatNone, isNotTime, hasEndDate)}
}
case CalcOperatorRange:
earliest := int64(0)
latest := int64(0)
- var isNotTime bool
+ var isNotTime, hasEndDate bool
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {
if 0 == earliest || earliest > row.Cells[colIndex].Value.Date.Content {
earliest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
+ hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
if 0 == latest || latest < row.Cells[colIndex].Value.Date.Content {
latest = row.Cells[colIndex].Value.Date.Content
isNotTime = row.Cells[colIndex].Value.Date.IsNotTime
+ hasEndDate = row.Cells[colIndex].Value.Date.HasEndDate
}
}
}
if 0 != earliest && 0 != latest {
- col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, latest, DateFormatDuration, isNotTime)}
+ col.Calc.Result = &Value{Date: NewFormattedValueDate(earliest, latest, DateFormatDuration, isNotTime, hasEndDate)}
}
}
}
diff --git a/kernel/av/value.go b/kernel/av/value.go
index fc7e55c52..f195af593 100644
--- a/kernel/av/value.go
+++ b/kernel/av/value.go
@@ -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,
}
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 5740bd5d5..93ba47f3c 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -117,7 +117,7 @@ func ExportAv2CSV(avID string) (zipPath string, err error) {
if nil != cell.Value {
if av.KeyTypeDate == cell.Value.Type {
if nil != cell.Value.Date {
- cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime)
+ cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime, cell.Value.Date.HasEndDate)
}
} else if av.KeyTypeCreated == cell.Value.Type {
if nil != cell.Value.Created {
@@ -2274,7 +2274,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool,
if nil != cell.Value {
if av.KeyTypeDate == cell.Value.Type {
if nil != cell.Value.Date {
- cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime)
+ cell.Value.Date = av.NewFormattedValueDate(cell.Value.Date.Content, cell.Value.Date.Content2, av.DateFormatNone, cell.Value.Date.IsNotTime, cell.Value.Date.HasEndDate)
}
} else if av.KeyTypeCreated == cell.Value.Type {
if nil != cell.Value.Created {
From ee1ae2ee7ec8d93254875f5a14bf5787c0ce81ce Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Fri, 23 Feb 2024 18:03:09 +0800
Subject: [PATCH 3/3] :memo: Update README
---
README.md | 2 +-
README_zh_CN.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index a893f0e80..f5c424fc4 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Refactor your thinking
-
+
diff --git a/README_zh_CN.md b/README_zh_CN.md
index 9a9e885c2..7d22a8909 100644
--- a/README_zh_CN.md
+++ b/README_zh_CN.md
@@ -20,7 +20,7 @@
-
+