Formatting date for Books Recurring Invoice

Formatting date for Books Recurring Invoice

Hello,
I am writing a function to create a Recurring Invoice from CRM, but am getting an error when trying to set up the Start Date.  

In the function, I'm getting a particular date field from the opp > find the next month > get the first day of that month; all of that part works.  When I try to pass that value into the Create Recurring Invoice, I get an error  

{"code":2,"message":"Invalid value passed for Start Date"}

My code:
  1. oneMonth = firstEngagementDate.addMonth(1);
  2. info "Initial Date Field Value: " + oneMonth;

  3. recTargetDate = oneMonth.toStartOfMonth();
  4. info "Beginning of Month: " + recTargetDate;

  5. recInvDate = recTargetDate.toString("yyyy-MM-dd");
  6. info "To String: " + recInvDate;

  7. backToDate = recInvDate.toDate("yyyy-MM-dd");
  8. info "Back to Date Format: " + backToDate;

My info statements return the following:
  • Initial Date Field Value: 28-Jan-2024
    Beginning of Month: 01-Jan-2024
    To String: 2024-01-01
    Back to Date Format: 01-Jan-2024

I've tried passing it as a String, I've tried passing the recTargetDate, I've tried the backToDate variable (obviously the same as recTargetDate).  It doesn't seem like my .toDate("yyyy-MM-dd") is working.

Any help is appreciated!