(task: TaskInfo, field: "due" | "scheduled")
| 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 |
no test coverage detected