Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/9486

Vanessa6225246d990b
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index e2d5b7b4d9..667fbf74d2 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -1,4 +1,5 @@
{
+ "includeTime": "Include time",
"accountSupport1": "So far, we have made more than 5,000 improvements to SiYuan. Our unremitting efforts are entirely due to users' recognition and support of SiYuan.",
"accountSupport2": "The development of SiYuan cannot be separated from your support. We will continue to make good products with our heart and provide you with a better knowledge management experience.",
"goToTab1": "Go to tab #1",
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index c4ec0f0cb8..7676fcaf71 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -1,4 +1,5 @@
{
+ "includeTime": "Incluir tiempo",
"accountSupport1": "Hasta ahora, hemos realizado más de 5000 mejoras en SiYuan. Nuestros incansables esfuerzos se deben enteramente al reconocimiento y apoyo de los usuarios a SiYuan.",
"accountSupport2": "El desarrollo de SiYuan no puede separarse de su apoyo. Continuaremos fabricando buenos productos con nuestro corazón y brindándole una mejor experiencia de gestión del conocimiento.",
"goToTab1": "Ir a la pestaña #1",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 2348714d5c..7369e140b2 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -1,4 +1,5 @@
{
+ "includeTime": "Inclure l'heure",
"accountSupport1": "Jusqu'à présent, nous avons apporté plus de 5 000 améliorations à SiYuan. Nos efforts inlassables sont entièrement dus à la reconnaissance et au soutien des utilisateurs pour SiYuan.",
"accountSupport2": "Le développement de SiYuan ne peut être séparé de votre soutien. Nous continuerons à fabriquer de bons produits avec notre cœur et à vous offrir une meilleure expérience de gestion des connaissances.",
"goToTab1": "Aller à l'onglet #1",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index e599ce1c92..6fa374544c 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -1,4 +1,5 @@
{
+ "includeTime": "具體時間",
"accountSupport1": "到目前為止,我們對思源筆記進行了 5000 多項改進,我們堅持不懈的努力完全源於用戶對思源筆記的認可和支持。",
"accountSupport2": "思源筆記的發展離不開你的支持,我們會繼續用心做好產品,為你提供更好的知識管理體驗。",
"goToTab1": "跳到第一個頁籤",
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index a568870fb4..3b83dc3f72 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -1,4 +1,5 @@
{
+ "includeTime": "具体时间",
"accountSupport1": "到目前为止,我们对思源笔记进行了 5000 多项改进,我们坚持不懈的努力完全源于用户对思源笔记的认可和支持。",
"accountSupport2": "思源笔记的发展离不开你的支持,我们会继续用心做好产品,为你提供更好的知识管理体验。",
"goToTab1": "跳转到第一个页签",
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts
index 2766f12124..cf13b33f71 100644
--- a/app/src/menus/commonMenuItem.ts
+++ b/app/src/menus/commonMenuItem.ts
@@ -36,7 +36,7 @@ export const openWechatNotify = (nodeElement: Element) => {
const reminder = nodeElement.getAttribute(Constants.CUSTOM_REMINDER_WECHAT);
let reminderFormat = "";
if (reminder) {
- reminderFormat = dayjs(reminder).format("YYYY-MM-DDTHH:mm");
+ reminderFormat = dayjs(reminder).format("YYYY-MM-DD HH:mm");
}
const dialog = new Dialog({
width: isMobile() ? "92vw" : "50vw",
@@ -101,7 +101,7 @@ export const openFileWechatNotify = (protyle: IProtyle) => {
const reminder = response.data.ial[Constants.CUSTOM_REMINDER_WECHAT];
let reminderFormat = "";
if (reminder) {
- reminderFormat = dayjs(reminder).format("YYYY-MM-DDTHH:mm");
+ reminderFormat = dayjs(reminder).format("YYYY-MM-DD HH:mm");
}
const dialog = new Dialog({
width: isMobile() ? "92vw" : "50vw",
@@ -162,7 +162,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
notifyHTML = `<label class="b3-label b3-label--noborder">
${window.siyuan.languages.wechatReminder}
<div class="fn__hr"></div>
- <input class="b3-text-field fn__block" type="datetime-local" readonly data-name="${item}" value="${dayjs(attrs[item]).format("YYYY-MM-DDTHH:mm")}">
+ <input class="b3-text-field fn__block" type="datetime-local" readonly data-name="${item}" value="${dayjs(attrs[item]).format("YYYY-MM-DD HH:mm")}">
</label>`;
} else if (item.indexOf("custom-av") > -1) {
hasAV = true;
diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts
index 0ddb0ed896..a387b2c103 100644
--- a/app/src/protyle/render/av/blockAttr.ts
+++ b/app/src/protyle/render/av/blockAttr.ts
@@ -33,14 +33,18 @@ export const genAVValueHTML = (value: IAVCellValue) => {
});
break;
case "date":
+ if (value[value.type].isNotEmpty) {
+ html = `<span data-content="${value[value.type].content}">${dayjs(value[value.type].content).format(value[value.type].isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm")}</span>`;
+ }
+ if (value[value.type].hasEndDate && value[value.type].isNotEmpty2 && value[value.type].isNotEmpty) {
+ html += `<svg class="custom-attr__avarrow"><use xlink:href="#iconForward"></use></svg><span data-content="${value[value.type].content2}">${dayjs(value[value.type].content2).format(value[value.type].isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm")}</span>`;
+ }
+ break;
case "created":
case "updated":
if (value[value.type].isNotEmpty) {
html = `<span data-content="${value[value.type].content}">${dayjs(value[value.type].content).format("YYYY-MM-DD HH:mm")}</span>`;
}
- if (value[value.type].hasEndDate && value[value.type].isNotEmpty2 && value[value.type].isNotEmpty) {
- html += `<svg class="custom-attr__avarrow"><use xlink:href="#iconForward"></use></svg><span data-content="${value[value.type].content2}">${dayjs(value[value.type].content2).format("YYYY-MM-DD HH:mm")}</span>`;
- }
break;
case "url":
html = `<input value="${value.url.content}" class="b3-text-field b3-text-field--text fn__flex-1">
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 3936b983d0..a38c86e5c4 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -113,6 +113,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
content2: null,
isNotEmpty2: false,
hasEndDate: false,
+ isNotTime: true,
}
};
}
diff --git a/app/src/protyle/render/av/date.ts b/app/src/protyle/render/av/date.ts
index 01aea4fd0a..62c18abd4e 100644
--- a/app/src/protyle/render/av/date.ts
+++ b/app/src/protyle/render/av/date.ts
@@ -27,22 +27,27 @@ export const getDateHTML = (data: IAVTable, cellElements: HTMLElement[]) => {
}
let value = "";
if (cellValue?.value?.date?.isNotEmpty) {
- value = dayjs(cellValue.value.date.content).format("YYYY-MM-DDTHH:mm");
+ value = dayjs(cellValue.value.date.content).format(cellValue.value.date.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
}
let value2 = "";
if (cellValue?.value?.date?.isNotEmpty2) {
- value2 = dayjs(cellValue.value.date.content2).format("YYYY-MM-DDTHH:mm");
+ value2 = dayjs(cellValue.value.date.content2).format(cellValue.value.date.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
}
return `<div class="b3-menu__items">
<div>
- <input type="datetime-local" value="${value}" class="b3-text-field fn__size200"><br>
- <input type="datetime-local" value="${value2}" style="margin-top: 8px" class="b3-text-field fn__size200${hasEndDate ? "" : " fn__none"}">
+ <input type="${cellValue.value.date.isNotTime ? "date" : "datetime-local"}" value="${value}" data-value="${value}" class="b3-text-field fn__size200"><br>
+ <input type="${cellValue.value.date.isNotTime ? "date" : "datetime-local"}" value="${value2}" data-value="${value2}" style="margin-top: 8px" class="b3-text-field fn__size200${hasEndDate ? "" : " fn__none"}">
<button class="b3-menu__separator"></button>
<label class="b3-menu__item">
<span>${window.siyuan.languages.endDate}</span>
<span class="fn__space fn__flex-1"></span>
<input type="checkbox" class="b3-switch fn__flex-center"${hasEndDate ? " checked" : ""}>
</label>
+ <label class="b3-menu__item">
+ <span>${window.siyuan.languages.includeTime}</span>
+ <span class="fn__space fn__flex-1"></span>
+ <input type="checkbox" class="b3-switch fn__flex-center"${cellValue.value.date.isNotTime ? "" : " checked"}>
+ </label>
<button class="b3-menu__separator"></button>
<button class="b3-menu__item" data-type="clearDate">
<svg class="b3-menu__icon"><use xlink:href="#iconTrashcan"></use></svg>
@@ -58,7 +63,7 @@ export const bindDateEvent = (options: {
menuElement: HTMLElement,
cellElements: HTMLElement[]
}) => {
- const inputElements: NodeListOf<HTMLInputElement> = options.menuElement.querySelectorAll(".b3-text-field");
+ const inputElements: NodeListOf<HTMLInputElement> = options.menuElement.querySelectorAll("input");
inputElements[0].addEventListener("change", () => {
setDateValue({
cellElements: options.cellElements,
@@ -69,6 +74,7 @@ export const bindDateEvent = (options: {
content: new Date(inputElements[0].value).getTime()
}
});
+ inputElements[0].dataset.value = inputElements[0].value;
});
inputElements[1].addEventListener("change", () => {
setDateValue({
@@ -80,10 +86,10 @@ export const bindDateEvent = (options: {
content2: new Date(inputElements[1].value).getTime()
}
});
+ inputElements[1].dataset.value = inputElements[1].value;
});
- const checkElement = options.menuElement.querySelector(".b3-switch") as HTMLInputElement;
- checkElement.addEventListener("change", () => {
- if (checkElement.checked) {
+ inputElements[2].addEventListener("change", () => {
+ if (inputElements[2].checked) {
inputElements[1].classList.remove("fn__none");
} else {
inputElements[1].classList.add("fn__none");
@@ -93,7 +99,28 @@ export const bindDateEvent = (options: {
data: options.data,
protyle: options.protyle,
value: {
- hasEndDate: checkElement.checked
+ hasEndDate: inputElements[2].checked
+ }
+ });
+ });
+ inputElements[3].addEventListener("change", () => {
+ if (inputElements[3].checked) {
+ inputElements[0].setAttribute("type", "datetime-local");
+ inputElements[1].setAttribute("type", "datetime-local");
+ inputElements[0].value = inputElements[0].dataset.value
+ inputElements[1].value = inputElements[1].dataset.value
+ } else {
+ inputElements[0].setAttribute("type", "date");
+ inputElements[1].setAttribute("type", "date");
+ inputElements[0].value = inputElements[0].dataset.value.substring(0, 10)
+ inputElements[1].value = inputElements[1].dataset.value.substring(0, 10)
+ }
+ setDateValue({
+ cellElements: options.cellElements,
+ data: options.data,
+ protyle: options.protyle,
+ value: {
+ isNotTime: !inputElements[3].checked
}
});
});
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index 862896911c..ac6371d1f2 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -245,11 +245,11 @@ export const setFilter = (options: {
const dateValue = options.filter.value ? options.filter.value[colData.type as "date"] : null;
menu.addItem({
iconHTML: "",
- label: `<input style="margin: 4px 0" value="${(dateValue.isNotEmpty || colData.type !== "date") ? dayjs(dateValue.content).format("YYYY-MM-DDTHH:mm") : ""}" type="datetime-local" class="b3-text-field fn__size200">`
+ label: `<input style="margin: 4px 0" value="${(dateValue.isNotEmpty || colData.type !== "date") ? dayjs(dateValue.content).format("YYYY-MM-DD") : ""}" type="date" class="b3-text-field fn__size200">`
});
menu.addItem({
iconHTML: "",
- label: `<input style="margin: 4px 0" value="${dateValue.isNotEmpty2 ? dayjs(dateValue.content2).format("YYYY-MM-DDTHH:mm") : ""}" type="datetime-local" class="b3-text-field fn__size200">`
+ label: `<input style="margin: 4px 0" value="${dateValue.isNotEmpty2 ? dayjs(dateValue.content2).format("YYYY-MM-DD") : ""}" type="date" class="b3-text-field fn__size200">`
});
}
menu.addItem({
@@ -377,15 +377,15 @@ export const getFiltersHTML = (data: IAVTable) => {
filterValue = ": " + window.siyuan.languages.filterOperatorIsNotEmpty;
} else if (filter.value?.date?.content) {
if (filter.value?.date?.content2 && filter.operator === "Is between") {
- filterValue = ` ${window.siyuan.languages.filterOperatorIsBetween} ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")} ${dayjs(filter.value.date.content2).format("YYYY-MM-DD HH:mm")}`;
+ filterValue = ` ${window.siyuan.languages.filterOperatorIsBetween} ${dayjs(filter.value.date.content).format("YYYY-MM-DD")} ${dayjs(filter.value.date.content2).format("YYYY-MM-DD")}`;
} else if ("=" === filter.operator) {
- filterValue = `: ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
+ filterValue = `: ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
} else if ([">", "<"].includes(filter.operator)) {
- filterValue = ` ${filter.operator} ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
+ filterValue = ` ${filter.operator} ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
} else if (">=" === filter.operator) {
- filterValue = ` ≥ ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
+ filterValue = ` ≥ ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
} else if ("<=" === filter.operator) {
- filterValue = ` ≤ ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
+ filterValue = ` ≤ ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
}
} else if (filter.value?.mSelect?.length > 0) {
let selectContent = "";
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index 2d1b4a7e5c..0935023520 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -827,7 +827,8 @@ export const openMenuPanel = (options: {
isNotEmpty: false,
content: null,
content2: null,
- hasEndDate: false
+ hasEndDate: false,
+ isNotTime: true,
}
});
avPanelElement.remove();
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 46b2bb4465..6605812eb5 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -120,10 +120,10 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
text = '<span class="av__celltext">';
const dataValue = cell.value ? cell.value.date : null;
if (dataValue && dataValue.isNotEmpty) {
- text += dayjs(dataValue.content).format("YYYY-MM-DD HH:mm");
+ text += dayjs(dataValue.content).format(dataValue.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
}
if (dataValue && dataValue.hasEndDate && dataValue.isNotEmpty && dataValue.isNotEmpty2) {
- text += `<svg class="av__cellicon"><use xlink:href="#iconForward"></use></svg>${dayjs(dataValue.content2).format("YYYY-MM-DD HH:mm")}`;
+ text += `<svg class="av__cellicon"><use xlink:href="#iconForward"></use></svg>${dayjs(dataValue.content2).format(dataValue.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm")}`;
}
text += "</span>";
} else if (["created", "updated"].includes(cell.valueType)) {
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 3642e215dc..c3b7c5247c 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -1097,7 +1097,7 @@ interface IAVCellDateValue {
content2?: number,
isNotEmpty2?: boolean
hasEndDate?: boolean
- isNotTime?: boolean
+ isNotTime?: boolean // 默认 true
}
interface IAVCellSelectValue {