The date string to coerce (ISO format or YYYY-MM-DD)
ISO string representing midnight on the specified date
This function is used in the CLI to normalize the --since parameter,
ensuring that calculations start at the exact beginning of the day in
the schedule's timezone.
coerceSince('2024-08-01');
// Returns: '2024-08-01T00:00:00.000+01:00' (or relevant timezone)
coerceSince('2024-08-01T14:30:00Z');
// Returns: '2024-08-01T00:00:00.000Z'
coerceSince('invalid-date');
// Throws: Error: Invalid date format: invalid-date. Expected ISO format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ).
Coerces a date string to the start of day (midnight) and returns ISO string with timezone.
Takes a date string (typically YYYY-MM-DD or ISO format) and normalizes it to the beginning of that day (00:00:00.000). Useful for ensuring date range queries start at the very beginning of the specified date.