In some cases, assignment creation can be called where the due date is earlier than the start date, because of somewhat unusual Turnitin date handling restrictions.
To avoid this edge case, we can set the assignment due date to the future during assignment creation to make sure it's not earlier than the start date. The followup assignment update call will set the real dates.
Date handling notes from TurnitinReviewServiceImpl.java by Steve Githens:
/* Some notes about start and due dates. This information is
- accurate as of Nov 12, 2009 and was determined by testing
- and experimentation with some Sash scripts.
- A turnitin due date, must be after the start date. This makes
- sense and follows the logic in both Assignments 1 and 2.
- When creating a new Turnitin Assignment, the start date
- must be todays date or later. The format for dates only
- includes the day, and not any specific times. I believe that,
- in order to make up for time zone differences between your
- location and the turnitin cloud, it can be basically the
- current day anywhere currently, with some slack. For instance
- I can create an assignment for yesterday, but not for 2 days
- ago. Doing so causes an error.
- However! For an existing turnitin assignment, you appear to
- have the liberty of changing the start date to sometime in
- the past. You can also change an assignment to have a due
- date in the past as long as it is still after the start date.
- So, to avoid errors when syncing information, or adding
- turnitin support to new or existing assignments we will:
- 1. If the assignment already exists we'll just save it.
- 2. If the assignment does not exist, we will save it once using
- todays date for the start and due date, and then save it again with
- the proper dates to ensure we're all tidied up and in line.
- Also, with our current class creation, due dates can be 5
- years out, but not further. This seems a bit lower priortity,
- but we still should figure out an appropriate way to deal
- with it if it does happen.