This code worked well; I had no issues with it until last week, when I flew to another state and opened my app to find that all of my databases were vanished. I'm not sure why this happened, but when I go home, my app works perfectly again. I figured out what was wrong, and it was a time zone change. Can you teach me how to get the date without using a time? I only care about the year, month, and day, but not the hour, minute, second, or time zone. Where can I get code that disregards the time?
My simplest code below
func getJournalData(forDate: Date) -> The_journal_data? {
let theDateCom = Calendar.current.dateComponents([.year, .month, .day], from: forDate)
let freshDate = Calendar.current.date(from: theDateCom)
let getRawData = theJournalData.first(where: { $0.date == freshDate })
return getRawData
}