Getting an error when I format date string


#1

I have a few actions that use a script line like:

Draft.content = Date.now().toString("dddd, MMM d")

This used to work, but after one of the recent updates (not sure exactly which) I started getting this error:

Script Error: RangeError: toString() radix argument must be between 2 and 36

I looked through the update notes and didn’t see anything that explained this. How should I change my script so it will work again?


#2

Try this and it is returning a numeric value.

alert(Date.now());

Then take a look at this for the error you’re seeing.

You can take a look at the links there or just do a Google search for formatting dates in Javascript. Alternatively take a look at the action belowin the directory for inspiration.

http://actions.getdrafts.com/a/1HO


#3

Thanks!

I was actually able to fix it easily just by changing Date.now() to Date.today()

That seems to be working well for me. Thanks for your help!