Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by ChuckMcM on Wednesday January 02, 2013 @03:19PM
(#4999008)
I find it fascinating that it doesn't work between 1/1/13 and 1/6/13 but claims it will start working on 1/7/13. What is different about the 7th than the 6th?
[ Parent
| on HN ]
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by osiemens on Wednesday January 02, 2013 @03:42PM
(#4999144)
It's a not entirely uncommon bug having to do with the naming of the first week of the year. Perhaps it's even as deep as NSCalendar, but I can't check that right now. ref: http://stackoverflow.com/questions/1106943/nscalendar-first-...
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by VMG on Wednesday January 02, 2013 @04:04PM
(#4999284)
Oh yes. The ISO definition is pretty straightforward: «The first week of a year is the week that contains the first Thursday of the year.» (http://en.wikipedia.org/wiki/ISO_week_date)
Actual implementations often look more like this: http://www.epoch-calendar.com/support/getting_iso_week.html
Implementing it as a one-liner would be an interesting code golf exercise.
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by kijeda on Wednesday January 02, 2013 @03:40PM
(#4999130)
I noticed a bug in another tool today, caused by the week-of-the-year value returned by strftime() returning '00' until the 6th. Possibly related?
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by MrHus on Wednesday January 02, 2013 @05:07PM
(#4999611)
I fixed the same bug today, it happens when using YYYY instead of yyyy as a dateformat. YYYY is the year of the week the day falls in.
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by lstrojny on Thursday January 03, 2013 @05:24AM
(#5001730)
Could you elaborate what exactly is the bug there?
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by MrHus on Thursday January 03, 2013 @12:58PM
(#5003559)
In my case I had a date that I needed to parse from JSON. It was in this format: 2012-01-21. I parsed it using YYYY-MM-dd. It should have been yyyy-MM-dd for the reasons above.
It is not technically a bug but it real easy to get wrong. Perhaps they should have picked sometimg other than YYYY for week years.
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by Derander on Wednesday January 02, 2013 @03:20PM
(#4999017)
It seems significant that this is exactly one week later.
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by bdash on Wednesday January 02, 2013 @03:31PM
(#4999077)
The 7th is the first day of the second week of the year.
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by evan_ on Wednesday January 02, 2013 @03:36PM
(#4999103)
So that seems like they're doing some kind of math using the week of year in the calculation- but for what purpose? The UI doesn't seem to give you any options for day of week, just time of day.
Maybe there's code in there that checks day of week but it's hardcoded to run every day to make the UI simpler.
Re:iOS 6: Do Not Disturb mode stays on after scheduled time
by Steko on Wednesday January 02, 2013 @03:38PM
(#4999122)
So maybe the service updates it's schedule weekly but the calculation ignores the year. This throws up an error at New Year's and borks the code that would reset when it's toggled on/off?