{"id":1391,"date":"2007-01-18T22:39:56","date_gmt":"2007-01-19T02:39:56","guid":{"rendered":"http:\/\/www.hoogervorst.ca\/arthur\/?p=1391"},"modified":"2007-01-19T22:07:28","modified_gmt":"2007-01-20T02:07:28","slug":"a-bug-you-say","status":"publish","type":"post","link":"http:\/\/www.hoogervorst.ca\/arthur\/?p=1391","title":{"rendered":"A bug, you say?"},"content":{"rendered":"<p><span class=\"dropcap\">T<\/span>here&#8217;s a silly bug in a C# method for the Calendar class, GetWeekOfYear: Its second parameter accepts a CalendarWeekRule enumeration with a choice of FirstDay, FirstFourDayWeek or FirstFullWeek. There&#8217;s a great example in the API\/documentation, however, the samples don&#8217;t seem to reflect North American date standards, where Sunday is generally the first day of a week.\n<\/p>\n<p>Confused? Let me try that again: Take for example the 31st of December of last year. That day fell on a Sunday and that day should be part of the <em>first<\/em> week of 2007 and not (as the method above consequently will return) part of week <em>53<\/em> of 2006. There&#8217;s no week 53 because our week starts with Sunday.\n<\/p>\n<p>To get around this, you&#8217;ll end up filtering the last days of a year you want to be part of the new year. Easy but not the most pretty solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&#8217;s a silly bug in a C# method for the Calendar class, GetWeekOfYear: Its second parameter accepts a CalendarWeekRule enumeration with a choice of FirstDay, FirstFourDayWeek or FirstFullWeek. There&#8217;s a great example in the API\/documentation, however, the samples don&#8217;t seem &hellip; <a href=\"http:\/\/www.hoogervorst.ca\/arthur\/?p=1391\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts\/1391"}],"collection":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1391"}],"version-history":[{"count":0,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=\/wp\/v2\/posts\/1391\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1391"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hoogervorst.ca\/arthur\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}