TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Apple’s latest Watch is crashing and rebooting due to Daylight Saving Time bug

15 pointsby lnguyenover 6 years ago

2 comments

gargravarrover 6 years ago
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?
Unknoobover 6 years ago
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.<p>extension Date {<p><pre><code> static func fromString(_ string: String) -&gt; Date { let formatter = DateFormatter() formatter.dateFormat = &quot;yyyy-M-d&quot; return formatter.date(from: string)! &#x2F;&#x2F;&#x2F;Force unwrap because I never pass invalid strings. }</code></pre> }<p>Even though I was passing a valid string it still crashed because it couldn&#x27;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&#x2F;month&#x2F;year so I just don&#x27;t use the hour&#x2F;minutes&#x2F;seconds).<p>I wonder if it&#x27;s the same bug causing a boot loop since it&#x27;s being used by iOS itself.