Most likely your problem is that you did not set a timezone for the user you're doing this with. This means that the client passes an offset to the server. This works as long as operations involving time are in the current timezone but not when something like DST changes, which is in effect a timezone change.
The solution would be to set a timezone for this user and/or to set a default timezone in your project.
You can read more on this topic at https://world.mendix.com/display/refguide3/Date+and+Time+Handling+in+3.0
In which timezones are the input and output dates you mention? I guess trimToDays trims to 00:00 in the user's timezone, but that could be 01:00 in UTC if the user's timezone has an offset of -1. When you want to trim a date to the begin of the day in UTC, you should use trimToDaysUTC. As for formatDateTime and formatDateTimeUTC.