Do Not Disturb (DND), a nifty new feature in iOS 6, has garnered quite a lot unwanted attention when folks on New Year’s Day realized it failed to turn off outside its scheduled time, causing them to miss alerts for phone calls, text messages and more.

As the problem persisted and news of another seemingly time-related iOS glitch made the headlines, Apple carelessly added to the controversy by airing the unfortunately-timed iPhone 5 ad, starring tennis celebrities Serena and Venus Williams and centered around the flawed feature.

Apple in a support doc acknowledged the bug and said it will fix itself  on January 7. But why DND failed in the first place and how will the bug just miraculously fix itself next week?

According to ArsTechnica, this is actually a common pitfall that can happen at the beginning of the new year. It comes down to the known problem dealing with the ISO versus Gregorian calendar.

The ISO week numbering system uses the YYYY format for the year whereas the Gregorian calendar uses the yyyy format. Depending on which week of the year it is, the ISO numbering system uses a date digit with 1 starting on Monday. For example, Tuesday of the 50th week of 2012 translates into 2012-W50-2 in the ISO week format.

The problem comes in when January 1 of the new year ends up falling on a date that doesn’t get along well with the ISO week format. The first day of 2013 started on a Tuesday, whereas (as noted by TUAW) the ISO standard expects the first week of the year to start on “the Monday that contains the first Thursday in January.” In this case, that would be January 7, 2013.

It’s a common problem, per this code sample which replicates the problem online.

What’s really interesting is that Apple warns about this mistake in its own developer documentation, advising programmers to avoid any problems by using the Gregorian calendar system instead.

“In most cases, yyyy and YYYY yield the same number, however they may be different. Typically you should use the calendar year”, the support doc reads.

One developer who spoke with Ars points out that Apple should probably only be looking at the time to turn DND on or off without even taking dates into account at all.

And as to why Apple advised users to be patient for the bug to fix itself and not offer a quick remedy in the form of a minor iOS software update, know that releasing a new code to hundreds of millions of iOS devices in the wild is anything but trivial.

Besides, each iOS software update must be thoroughly tested, which takes weeks. Therefore, Apple opted to wait rather than risk introducing new bugs by hastily putting together an iOS software update.

Nevertheless, it’s genuinely perplexing that Apple itself has fallen prey of this common mistake with the date format, don’t you think?

Maybe the iOS team should read its own documentation more carefully?