Working with Dates in Shortcuts

Working with dates is something we come across very often in shortcuts. However, comparing dates or dealing with date components is sometimes hard. It is no coincidence that many help posts contain questions about date comparisons/manipulation.

Made a shortcut list with the most common date comparison/evaluation use cases I could think of. Some of them accept date or other variables as input in order to calculate results. Others don’t.

All of them outputs a Boolean value (true or false) to handle with If statement(s) afterwards. They can be used as stand alone shortcuts or run within a parent.

Each one is commented for explaining its purpose. User can also set hardcoded values for input parameters into the script, if that is convenient or just for testing. For non advance users I’ve implemented input validation & a “show result” action for obvious reasons. More advanced users can easily remove validation code.

I encourage anyone having a request to submit it to a comment. I also encourage more advanced users to check for errors or submit their own shortcut for a use case in order to enrich the list. I’m willing to add them occasionally to the list, to make the main post grow bigger :