I can create an action with a single script step containing:
strftime(Date(), "%Y");
and when I run it Drafts instantly crashes. (Drafts 25.1.4, both iPadOS 14.4 beta 2 and iOS 14.3). First, does this work for other people? If not, how should I be calling the function? The docs are pretty straightforward and wouldn’t seem to leave a lot of room for error.
I’ll fix the crash…the app should capture for invalid values.
But the reason is that Date() does not return a Date object in JavaScript. It returns a string. You need to use new to instantiate an object of Date type.
@sylumer’s example works, or just strftime(new Date(), "%Y"); should be fine as well.