Date format for Reminders due date?

I’m trying to repurpose my Things spaces repetition script to Reminders. I can get the Reminders created fine, but the due dates are all off. Here’s the code I’m using: I guess the date format isn’t right?

 var d3 = Date.today().add(4).days();
 var rep3 = d3.toString('yyyy-MM-dd');
 
 var todo3 = list.createReminder();
 todo3.title = "review note";
 todo3.dueDate = rep3;
 todo3.notes = link;
 todo3.update();

The dueDate property is a date, not a string. You should just assign your d3 date directly, like:

todo3.dueDate = d3;

That did it, thanks. Learning JavaScript by taking apart existing scripts here leaves me with these kinds of weird gaps.

1 Like