An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Database `Created time` field filtering is not working https://github.com/siyuan-note/siyuan/issues/18017
Daniel82c7a8b6bb0e
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex 77fa42d1c1..f1fd22c4a4 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -176,7 +176,7 @@ const transformCellValue = (colType: TAVCol, value: IAVCellValue): IAVCellValuetype: colType,};if (colType === "number") {- if (["date", "created", "updated"].includes(colType)) {+ if (["date", "created", "updated"].includes(value.type)) {newValue.number = {content: value[value.type as "date"].content,isNotEmpty: value[value.type as "date"].isNotEmptydiff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.tsindex b65636a034..44dc0cb892 100644--- a/app/src/protyle/render/av/filter.ts+++ b/app/src/protyle/render/av/filter.ts@@ -490,12 +490,18 @@ const genInlineDateHTML = (filter: IAVFilter, valueType: TAVCol, path: string):const showToday2 = !filter.relativeDate2?.direction;const isBetween = filter.operator === "Is between";+ // formatAbsDate 把时间戳格式化为 yyyy-MM-dd;空值/非法值返回 "",避免 <input type="date"> 报 "Invalid Date"。+ const formatAbsDate = (timestamp: any): string => {+ const dayObj = dayjs(timestamp);+ return dayObj.isValid() ? dayObj.format("YYYY-MM-DD") : "";+ };+const dateBlock = (suffix: "" | "2", relativeDate: IAVRelativeDate, dateVal: any, showToday: boolean): string => {const dateTypeSel = `<select class="b3-select" data-type="dateType${suffix}" data-path="${path}"><option value="time"${!relativeDate ? " selected" : ""}>${window.siyuan.languages.includeTime}</option><option value="custom"${relativeDate ? " selected" : ""}>${window.siyuan.languages.relativeToToday}</option></select>`;- const absDate = `<input value="${(dateVal && (dateVal.isNotEmpty || (suffix === "2" ? dateVal.isNotEmpty2 : valueType !== "date"))) ? dayjs(suffix === "2" ? dateVal.content2 : dateVal.content).format("YYYY-MM-DD") : ""}" type="date" max="9999-12-31" class="b3-text-field b3-text-field--text" data-type="absDate${suffix}" data-path="${path}" style="${relativeDate ? "display:none;" : ""}">`;+ const absDate = `<input value="${(dateVal && (dateVal.isNotEmpty || (suffix === "2" ? dateVal.isNotEmpty2 : valueType !== "date"))) ? formatAbsDate(suffix === "2" ? dateVal.content2 : dateVal.content) : ""}" type="date" max="9999-12-31" class="b3-text-field b3-text-field--text" data-type="absDate${suffix}" data-path="${path}" style="${relativeDate ? "display:none;" : ""}">`;const relDir = `<select class="b3-select" data-type="dataDirection${suffix}" data-path="${path}" style="${!relativeDate ? "display:none;" : ""}"><option value="-1"${relativeDate?.direction === -1 ? " selected" : ""}>${window.siyuan.languages.pastDate}</option><option value="1"${relativeDate?.direction === 1 ? " selected" : ""}>${window.siyuan.languages.nextDate}</option>