I am trying to store Date
data for user actions and set it to always be at start of the day no matter what time user performed the action i.e. User can perform 30 different actions and all of them are stored under the same Date
.
However following produces weird results (it’s 29th June at the moment of writing this), but for some reason calendars .startOfDay
produces 28th?
print(Date())
print(Calendar.current.startOfDay(for: Date()))
// 2024-06-29 14:30:18 +0000
// 2024-06-28 21:00:00 +0000
Is there a way to ensure same day is respected?