The nth Weekday After Today

Inspired by @drdrang's blog post on updating their "get the nth weekday" shell script to KM, I thought I'd go the whole hog and try using the ICUDateTimePlus token.

To add to the fun I decided to generate all the formats with a single action -- and hold those formats in separate variables to make changes easier. The resulting mess of %s is, perhaps, a lesson on why it's often better to use more actions and so make future maintenance easier :wink:

If nothing else it was a good exercise in KM tokens, filters, and date/time formatting. But I'm sure there are improvements to be had -- the ordinals, for example -- so all advice/criticism welcomed!

Next Weekday.kmmacros (7.4 KB)

Image

1 Like