7.3 - Days Until ...

Downloadable Shortcut:
7.3 - Days Until

Transcript:

Here's kind of a fun one to calculate dates for you. I have a lot of dates in the future I'm looking forward to, and it's fun for me to have Shortcuts figure out the time between. I tried to build this in a sort of component fashion, so you could add more if you wanted. 

As is written, it's using a Calendar action to Get time between dates to ... and then that's the Current Date, and December 25th, which is Christmas, and July 15th, which is when my vacation starts. You'll note that I didn't put the years here, and it'll always look to the next one that way, so it updates yearly. 

I'm going to make another one. I'm just going to duplicate this. So, I'm going to right-click here and say Duplicate. And I'm going to say May the 4th, you know, a lot of Star Wars fans have fun on May the 4th. I'll make that one too. So, I've just added another date to it. If I go down to the text here, I'll just say, "May the Fourth is in." And we're going to use a magic variable here, so I'll right-click Insert Variable >, Select Variable, and we're going to pick this one right here. I can write days at the end. And I'm going to rename this one. Double-clicking it, and we're going to call that, "May the Fourth." I should have renamed this vacation one too. So, let's go ahead and do that. And if you want to see the names of the variables, just tap Insert Variable > anywhere, and you'll see, there they are. So, they're listed, and it's easy to keep track of them. I'm a big fan, and you've heard it throughout this field guide, but of naming variables allows you to avoid problems later. So, take the time to do that. But I'm not going to pick any variables. I just wanted to show them. So, we've got three steps here: Current Date between December 25th, May the 4th, and July 15th. And just report it that or just collect some Text, and then Show an alert with that Text in it. We don't need to see Cancel Button. Let's go ahead and run this. And there it is: 63 days until May the Fourth, 135 days until vacation, 298 days until Christmas. We're under 300. 

If you want to have some fun with this, you could add the Speak Text command in here. I'm going to drag it in. And the trick here is to not put it at the bottom, because if you do that, you have to click the OK button before it executes. Instead, put it before it. And now it's going to read the Text and show the alert. So, we'll go ahead and run that. "Christmas is in 298 days. May the Fourth is in 63 days. Vacation Starts in 135 days." And there's my alert. 

I tried to make this one so it's easy to modify. So, download it and put whatever dates you want in it, and let Shortcuts do the work for you. 

Complete and Continue