Are you trying to get the data from the database? Do you have start_date and end_date fields in your table? Or are you trying to query between a date field and current date?
@jlrdw the OP's problem is the actual date string being used to create either the start or end Carbon instance(s) as I mentioned previously above.. The CarbonPeriod instance is not the problem; and a loop does nothing to solve this...
@jlrdw Thanks for you help that's what i was looking for, would you also know how i can set it to the format ("Y-m") instead of ("Y-m-d") ?
Edit: I found the solution, i just had to change $dateRange to this:
@Mar55 what are you doing? Your date range will have exactly one date - why are you looking to create a Period with 1 month interval when the dates are days apart?
And none of this relates to the InvalidFormatExceptiontrailing data error you mentioned in the OP.