dueDate on Reminder - how to specify type date vs string?

I wish to set a due date on a reminder. In this example, per the error message I receive, I understand that I am incorrectly sending a string when it should be type Date.

How do I do that? What is the proper syntax?

var ReminderEntry = "test"
var ReminderDue = "2021-01-04 23:10"
const calendar = await Calendar.forRemindersByTitle("Reminders");
const reminder = new Reminder();
reminder.title = ReminderEntry;
reminder.dueDate = ReminderDue
reminder.calendar = calendar;

Thank you in advance,


Parse the date string.

Bonjour John,

You can try maybe

let DateReminderDue = "2021-01-04 23:10"
let df = new DateFormatter()
df.dateFormat = "yy-MM-dd HH:mm"
ReminderDue = df.date(DateReminderDue)

Thank you for the background info, for context, @sylumer.

Thank you for the solution, @WB2020. My reminder shortcut is noticeably faster.