Other than checking their planner, you can change the Actual End Date of the maternity, as the booked holiday after the maternity ends will be a different holiday and not part of the maternity.
To do so:
Click the Employees tab, then choose the relevant employee.
Click on Planner, then click on the maternity leave.
Amend the Actual End Date to reflect the very last day of their leave.
When doing queries, to avoid getting duplicate results and inaccurate data, you will need to make separate ones for every instance: a query on maternity details and a separate one on holidays to show you the additional holiday that the user had.