I'm going out of mind with the following issue.
That's normal, everything related to computations on dates and times will rapidly make you mad. Obligatory xkcd: https://www.xkcd.com/2867/
In this case, the key is probably timezones. If you convert a date to a time and then back to a date you can end up with a different date, because the conversion to time is probably at midnight, and I guess midnight in Italy is 22:00 the previous day in UTC.
Sorry, I don't have a concrete answer to what you need to change to make your code work. But focus on time zones.
Topic:
Programming Languages
SubTopic:
Swift
Tags: