fix property calendar empty dates

This commit is contained in:
callumalpass 2026-05-31 04:42:46 +10:00
parent 35f19f4706
commit 7b6a9cdb84
4 changed files with 25 additions and 1 deletions

View file

@ -26,6 +26,7 @@ Example:
## Fixed
- (#1974) Stopped Calendar and Agenda property-based events from logging date parse errors for entries that do not have the selected date property. Thanks to @Jomo94 for suggesting completed-date Agenda events.
- (#1973) Reduced unnecessary Calendar view recreations when external calendar providers are reported in a different order, and preserved Calendar scroll position when a config-driven refresh has to recreate the view. Thanks to @e-zz for reporting this.
- (#1972) Fixed ICS calendar event related notes so standalone events with similar numeric IDs no longer show unrelated notes or tasks on every event. Thanks to @ks-studio-net for reporting this.
- (#1970) Fixed TaskNotes Bases views still rendering task files from excluded folders. Thanks to @henrim01 for reporting that this still affected 4.9.2.

View file

@ -536,6 +536,21 @@ views:
Used by the **Agenda** command to display tasks in a list-based agenda view.
Note: Property-based events are disabled by default to avoid duplicate entries when tasks already have due/scheduled dates.
To build an Agenda variant for completed tasks that do not have due or scheduled dates, enable property-based events and use the completed-date property as the event start date:
```yaml
options:
showScheduled: false
showDue: false
showRecurring: false
showTimeEntries: false
showPropertyBasedEvents: true
createDailyNotesFromDateLinks: true
calendarView: "listWeek"
startDateProperty: completedDate
listDayCount: 7
titleProperty: file.basename
```
```yaml
# Agenda

View file

@ -51,7 +51,10 @@ export type BuildCalendarPropertyEventInput<TEntry> = {
export function normalizeDateValueForCalendar(value: unknown): CalendarDateValue | null {
if (typeof value === "string") {
const trimmed = value.trim();
if (!trimmed) return null;
const normalizedEmptyValue = trimmed.toLowerCase();
if (!trimmed || normalizedEmptyValue === "null" || normalizedEmptyValue === "undefined") {
return null;
}
if (hasTimeComponent(trimmed)) {
const parsed = parseDateToLocal(trimmed);

View file

@ -23,6 +23,11 @@ describe("calendarPropertyEvents", () => {
expect(normalizeDateValueForCalendar(" ")).toBeNull();
expect(normalizeDateValueForCalendar(new Date("not-a-date"))).toBeNull();
});
it("treats Bases stringified empty values as missing", () => {
expect(normalizeDateValueForCalendar("null")).toBeNull();
expect(normalizeDateValueForCalendar("undefined")).toBeNull();
});
});
describe("buildCalendarPropertyEvent", () => {