MCPcopy
hub / github.com/callumalpass/tasknotes / openTaskDatePicker

Method openTaskDatePicker

src/main.ts:1353–1381  ·  view source on GitHub ↗
(task: TaskInfo, field: "due" | "scheduled")

Source from the content-addressed store, hash-verified

1351 }
1352
1353 private async openTaskDatePicker(task: TaskInfo, field: "due" | "scheduled") {
1354 try {
1355 const { DateTimePickerModal } = await import("./modals/DateTimePickerModal");
1356 const { getDatePart, getTimePart, combineDateAndTime } = await import(
1357 "./utils/dateUtils"
1358 );
1359 const currentValue = (field === "due" ? task.due : task.scheduled) || "";
1360 const modal = new DateTimePickerModal(this.app, {
1361 currentDate: getDatePart(currentValue) || null,
1362 currentTime: getTimePart(currentValue) || null,
1363 dateRole: field,
1364 plugin: this,
1365 onSelect: (date, time) => {
1366 void (async () => {
1367 const value =
1368 date && time ? combineDateAndTime(date, time) : date || undefined;
1369 await this.taskService.updateProperty(task, field, value);
1370 })();
1371 },
1372 });
1373 modal.open();
1374 } catch (error) {
1375 tasknotesLogger.error("Error loading DateTimePickerModal:", {
1376 category: "validation",
1377 operation: "loading-datetimepickermodal",
1378 error: error,
1379 });
1380 }
1381 }
1382
1383 /**
1384 * Refreshes the TaskNotes cache by clearing all cached data and re-initializing

Callers 2

openDueDateModalMethod · 0.95

Calls 6

getDatePartFunction · 0.85
getTimePartFunction · 0.85
combineDateAndTimeFunction · 0.85
updatePropertyMethod · 0.80
errorMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected