I have code that sets a displayed text to red if the date is today or sooner (the displayed date has passed).
// If we're at or past the expiration date, // display it in red. let expired = item.expirationDate < Date() let isToday = Calendar.current.isDateInToday(item.expirationDate) Text("\(item.expirationDate, formatter: dateFormatter)") .foregroundColor(expired || isToday ? .red : .none)
Today a displayed date of today did not show up in red, even though this had worked previously. I decided to do what I usually do for Windows problems: reboot my phone.
After the reboot, the date correctly displayed in red.
Is this an iOS bug?