Hacker News new | past | comments | ask | show | jobs | submit login
Apple’s latest Watch is crashing and rebooting due to Daylight Saving Time bug (theverge.com)
15 points by lnguyen on Oct 8, 2018 | hide | past | favorite | 2 comments



You might think that a device whose first and foremost purpose for existing is telling the time, might, y'know, actually be capable of doing so?


Last week I noticed that when I tried to create a Date object in Swift using a Date Formatter and passing in a string with the date where DST starts in my country it would crash my app.

extension Date {

    static func fromString(_ string: String) -> Date {
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy-M-d"
        return formatter.date(from: string)! ///Force unwrap because I never pass invalid strings.
    }
}

Even though I was passing a valid string it still crashed because it couldn't parse it into a date. I solved the problem by adding a random hour to the date(All that mattered to me is the day/month/year so I just don't use the hour/minutes/seconds).

I wonder if it's the same bug causing a boot loop since it's being used by iOS itself.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: