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

Method addDateOptions

src/components/BatchContextMenu.ts:289–322  ·  view source on GitHub ↗
(submenu: Menu, dateType: "due" | "scheduled")

Source from the content-addressed store, hash-verified

287 }
288
289 private addDateOptions(submenu: Menu, dateType: "due" | "scheduled"): void {
290 const dateContextMenu = new DateContextMenu({
291 currentValue: undefined,
292 onSelect: () => {},
293 plugin: this.options.plugin,
294 app: this.options.plugin.app,
295 });
296
297 const dateOptions = dateContextMenu.getDateOptions();
298
299 // Basic date options only (skip increment options as they don't work correctly for batch)
300 const basicOptions = dateOptions.filter(
301 (option: DateOption) => option.category === "basic"
302 );
303 for (const option of basicOptions) {
304 submenu.addItem((item) => {
305 if (option.icon) item.setIcon(option.icon);
306 item.setTitle(option.label);
307 item.onClick(async () => {
308 await this.batchUpdateProperty(dateType, option.value);
309 });
310 });
311 }
312
313 // Clear date option
314 submenu.addSeparator();
315 submenu.addItem((item) => {
316 item.setTitle(this.t("contextMenus.date.clearDate"));
317 item.setIcon("x");
318 item.onClick(async () => {
319 await this.batchUpdateProperty(dateType, undefined);
320 });
321 });
322 }
323
324 private async openBatchTagInput(mode: "add" | "remove"): Promise<void> {
325 const { plugin } = this.options;

Callers 1

buildMenuMethod · 0.95

Calls 5

getDateOptionsMethod · 0.95
batchUpdatePropertyMethod · 0.95
tMethod · 0.95
setIconMethod · 0.80
onClickMethod · 0.80

Tested by

no test coverage detected