Ask how much to shift

I currently have a shortcut that produces an output that allows you to enter a date and then it adds 12 weeks. Is there a way to make the number of weeks in the shift a part of a form? For instance instead of 12 weeks from 2/23/22 as it is currently setup, is there a way to make the 12 weeks a fillable value, so I could input 10 and get 10 weeks from 2/23/22. Below is how it is currently setup

{note}{formdate: MM/DD/YYYY; name=date}{endnote}{time: MM/DD/YYYY; at={=date}; pattern=MM/DD/YYYY; shift=+4W}

I tried to input shift=+{formtext} but that didn't work

I was able to use a variable instead of the 4 in "shift=+4W"

I used a text field and named it weeks and then used the variable in place of the 4. I have a place holder of 4 that could be changed to whatever other number. Alternatively, and the way I'd probably do it, you could use a dropdown menu form in place of the text field so that you could choose the number of weeks.

Hi @Aaron_Hall - welcome to the forum!

You're on the right track, but you're missing a small part.

Here's how you do it:

{formtext: name=shifting; default=12}

The date today is {time: dddd, MMMM Do, YYYY}
When I shift it forward by {=shifting} weeks, it will be {time: dddd, MMMM Do, YYYY; shift={=shifting}W}

Note that you can even put a negative number to shift backwards.

Let me know if you have any other questions.

Someone in support just asked a similar question to this, so I'm going to add an example for them in this thread, so it will benefit everyone :slight_smile:

{formtext: name=shifting; default=12}

The date today is {time: dddd, MMMM Do, YYYY}
When I shift it forward by 25 days, it will be {time: dddd, MMMM Do, YYYY; shift=25D}

Awesome! Thanks!

Is there a way to have a input the number of weeks to shift and ONLY display the shifted date?

{note}{formdate: MM/DD/YYYY; name=date} {formtext: name=shifting; default=12}

{endnote:trim=right}

{time: MM/DD/YYYY; at={=date}; pattern=MM/DD/YYYY; shift={=shifting}W}

@Aaron_Hall - thanks for the response. I've edited your post to turn it into a dynamic snippet.

Additionally, I've added a couple of line breaks before the {endnote} command and included a trim=right setting to it. This makes the snippet preview easier to understand :slight_smile:

You can find out more about the trim setting here: