I don't know if it is the best way, but here's a pretty good way:
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Example Output
MACRO: Use Date Calculator to Get Multilpe Dates [Example]
-~~~ VER: 2.1 2020-09-13 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Use Date Calculator to Get Multilpe Dates [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
ReleaseNotes
Author.@JMichaelTX
PURPOSE:
- Use Date Calculator to Get Multilpe Dates
- While KM provides extensive handling of dates using the ICU tokens & functions, it is very laborous to write a macro which calculates a new date from a date other than the current date.
- The Action in this macro presents an alternative to using KM ICU tokens.
- It provides one KM Action, a Shell Script with a Bash date command, to accomplishes this with only 5 lines, and yet is very configurable.
- It only requires two inputs, which the macro author can enter as KM Variable Tokens in the Execute Shell Script Action Input area, which are Parameters for the script Standard In (stdin):
- Base Date
- Adjust by amount (in days, +/-)
- By Default, the script uses this data, which can be easily overridden:
- Adjust By Units: Days
- Date Input Format: ISO 8601 YYYY-MM-DD
- Date Output Format: ISO 8601 YYYY-MM-DD
- Override these by adding Parameters to the Script Input area.
- If you don't like the defaults, you can easily change the defaults in the script.
REQUIRES:
- KM 7+
- macOS 10.10+ (Yosemite)
- However, it has been tested ONLY in KM 8.2.2 with macOS 10.12.6
- However, it has been tested ONLY in KM 8.2.2 with macOS 10.12.6
How To Use
As a Demo
- Just Trigger this macro.
- Enter the Base Date and Offset
- Observe Results
As a Reusable Action
- Save the Execute Shell Script Action somewhere for easy reuse
(choose one of these:)- I recommend the KMFAM Macro System by @DanThomas
- Setup as a Sub-Macro, which can be called using an Execute Macro Action
- Paste the Script Parameters as Parameters to the Execute Macro Action
- Store in a "template" macro where you can copy/paste into new Macros
MACRO SETUP
- Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me. ??
.
- Assign a Trigger to this maro..
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro.
.
- REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)- Prompt for User Input
- You can change the defaults for BaseDate and AdjustBy (which MUST include the sign), but do NOT change the Units.
- Prompt for User Input