Syntax help for a Suggester for VDATE (with Natrual Language Date) input in Quick Add capture format #690
Replies: 1 comment
|
Sorry for the very slow reply. First, why the nested-token attempts can't work: inside The good news is VDATE has grown since 2024 and probably covers most of what you were reaching for:
Typing
module.exports = async (params) => {
const { quickAddApi } = params;
const moment = window.moment;
const options = {
"Tomorrow": () => moment().add(1, "day"),
"Next week": () => moment().add(1, "week"),
"Monday": () => moment().day(8),
"No reminder": () => null,
};
const labels = Object.keys(options);
const pick = await quickAddApi.suggester(labels, labels);
if (pick === undefined) {
params.abort("Cancelled.");
return;
}
const when = options[pick]();
params.variables.reminder = when ? when.format("YYYY-MM-DD HH:mm") : "";
};
One more thing from your format string: Picking "Tomorrow" wrote Docs: https://quickadd.obsidian.guide/docs/FormatSyntax#vdate |
Uh oh!
There was an error while loading. Please reload this page.
What I’m trying to do
I use Quick Add’s capture format to create tasks. I’m trying to get an optional Reminder date added to a task that, when chosen, will use a Suggester to populate the date. I can do the former, be not the latter.
Basically, I got annoyed with having to type “Tomorrow” or “Next Week” and figured I could click on suggester options instead.
I’ve experimented with a few things but can’t crack it.
Here’s the full Capture format:
#{{FIELD:tags}} :pencil2:{{selected}}{{VALUE:, <% tp.system.clipboard()%>}} {{VALUE:Task Description}} _-{{VALUE:, Reminder: (@{{VDATE:Reminder-Date, [[YYYY-MM-DD]] HH:mm}})}} :heavy_plus_sign: [[{{Date}}]] {{VALUE::stop_button:, , :small_red_triangle:, :arrow_double_up:, :arrow_up_small:, :arrow_down_small:, :arrow_double_down:}}Things I have tried
As above, the closest I can get so far is:
{{VALUE:, Reminder: (@{{VDATE:Reminder-Date, [[YYYY-MM-DD]] HH:mm}})}}That gives me an optional Reminder date Reminder: (@ token and if I select the blank option I don’t get any other text there, which is good.
In this one, the VDATE resolves as Reminder: (@{{VDATE:monday)}}:
{{VALUE:, Reminder: (@{{VDATE:{{FIELD:reminder_time_options}}, [[YYYY-MM-DD]] HH:mm}})}} :heavy_plus_sign: [[{{Date}}]] {{VALUE::stop_button:, , :small_red_triangle:, :arrow_double_up:, :arrow_up_small:, :arrow_down_small:, :arrow_double_down:}}Any use of commas in VDATE causes it to behave like a dropdown but won’t resolve as a date:
{{VALUE:, Reminder: (@{{VDATE:{{VALUE:monday, tomorrow}}, [[YYYY-MM-DD]] HH:mm}})}}{{VALUE:, Reminder: (@{{VDATE:monday, tomorrow, [[YYYY-MM-DD]] HH:mm}})}}(This is a dupe of a post on the Obsidian forums. That got no reply so I thought I'd try here. Hope that's OK)
All reactions