You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] {{DATE}} isn't scoped for choices nested under macro when set to variable #2242
Describe the bug
When there are multiple nested choices within a macro that all specify {{DATE}} to use a different variable, only the first one gets set and used globally for the whole run. This seems to be specific to setting DATE to use a variable. Other options seem to work.
This also appears to happen when calling multiple executeChoice() functions in a script with different options.date values set.
To Reproduce
Steps to reproduce the behavior in Obsidian:
Create a template that just has {{DATE}} for the content
Create a script that sets two variables: yesterday and tomorrow
Create a quick add macro
Add the above script. Add the above template twice. In the first one, adjust {{DATE}} to use the variable "yesterday". In the second one set it to use "tomorrow". Use {{DATE}} for the filename.
Run the macro
Note only one file gets created, rather than two
Expected behavior
Two files get created one with filename/content equal to yesterday's date, one with filename/content equal to tomorrow's date.
Obsidian Debug Info (required for bug reports)
Please include the full Debug Info from Obsidian to help diagnose your environment:
Open the Command Palette (Ctrl/Cmd+P).
Run: Show debug info.
Click: Copy to clipboard.
Paste it below inside the code block.
SYSTEM INFO:
Obsidian version: 1.14.4
Installer version: 1.14.4
Operating system: Windows 11 Pro 10.0.26300
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 1
1: QuickAdd v2.32.1
RECOMMENDATIONS:
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
changed the title [-][BUG] {{DATE}} isn't scoped for choices nested under macro[/-][+][BUG] {{DATE}} isn't scoped for choices nested under macro when set to variable[/+]on Oct 16, 2026
Hey @aarontcannon! Thanks for the report, and for the clear repro steps. They made this easy to pin down. I could reproduce it, and it's fixed in #2243, which will ship in the next QuickAdd release.
QuickAdd remembered the day the first Template picked, and kept using it for the rest of the macro. So your second Template, set to tomorrow, got yesterday's date too, and both tried to write the same file. Now a choice's Which day only applies to that choice and to anything it runs itself. A Macro's own Which day still applies to every choice inside it.
I tested it in Obsidian with your setup: a template with just {{DATE}}, a script that sets yesterday and tomorrow, and a macro that runs the template twice, once with each variable. Before the fix, it created one file. After the fix, it creates two, each named and filled with its own date.
About executeChoice(). Scripts are covered too. Each executeChoice() call now gets its own day, whether it comes from options.date or from a date variable the choice reads, and that day no longer carries over to later steps in the macro. One part I couldn't reproduce: repeated calls with different options.date values already worked for me when the called Template's Which day was left on Today. If your script still creates only one file after you update, please paste it here.
Until the release is out, you can get both files from a script. Leave the template's Which day on Today, and pass the date in each call:
Activity
[-][BUG] {{DATE}} isn't scoped for choices nested under macro[/-][+][BUG] {{DATE}} isn't scoped for choices nested under macro when set to variable[/+]test(date): cover per-choice Which day in macros and executeChoice
fix(date): scope Which day to the choice that sets it
chhoumann commentedon Oct 16, 2026
Hey @aarontcannon! Thanks for the report, and for the clear repro steps. They made this easy to pin down. I could reproduce it, and it's fixed in #2243, which will ship in the next QuickAdd release.
QuickAdd remembered the day the first Template picked, and kept using it for the rest of the macro. So your second Template, set to
tomorrow, got yesterday's date too, and both tried to write the same file. Now a choice's Which day only applies to that choice and to anything it runs itself. A Macro's own Which day still applies to every choice inside it.I tested it in Obsidian with your setup: a template with just
{{DATE}}, a script that setsyesterdayandtomorrow, and a macro that runs the template twice, once with each variable. Before the fix, it created one file. After the fix, it creates two, each named and filled with its own date.About
executeChoice(). Scripts are covered too. EachexecuteChoice()call now gets its own day, whether it comes fromoptions.dateor from a date variable the choice reads, and that day no longer carries over to later steps in the macro. One part I couldn't reproduce: repeated calls with differentoptions.datevalues already worked for me when the called Template's Which day was left on Today. If your script still creates only one file after you update, please paste it here.Until the release is out, you can get both files from a script. Leave the template's Which day on Today, and pass the date in each call:
Replace
Your templatewith your Template choice's name. Let me know if anything still acts up after you update!fix(date): scope Which day to the choice that sets it (chhoumann#2243)