Programming around dates, times, and timezones is painful. I’ve done this in Python and in JavaScript and it was miserable either way. It’s due to the complexities of time that we mostly ignore in our day to day lives. We are able to do this because we generally are not in multiple timezones at the same time, and we are not trying to work in Standard and Daylight Savings times simultaneously, and we aren’t adding or subtracting arbitrary lengths of time from other times. Yet when you’re programming around time, you pretty much have to do all of these things. The internet is global, your feature needs to work properly in the summer AND in the winter, and calculating differences in time is almost inevitable.
The good news is that puzzling through these problems once makes them less bad the next time around. Not that it’s easier, but at least you know the fight you’re getting into.