That's as per the documentation, isn't it?
Note: If you use the periods parameter in combination with the fromDate and toDate parameters then the specified date range will apply to each period (i.e. if the specified date range is for a 30 day month, each prior period will only include the first 30 days). To ensure you always get a full month of data in previous periods you would need to start in a month with 31 days (e.g. start in July instead of June)
From: https://developer.xero.com/documentation/api/accounting/reports#profit-and-loss
Sounds like a strange "feature", but not unexpected behaviour.