ios - NSCalendar.components().minute returning inconsistent values -
original problem encountered during post, testing , code in link below https://stackoverflow.com/questions/27339072/working-with-nsdate-components-in-swift/30822018#30822018 here minimal test-case i creating date offset particular date (self in case in nsdate() extension) using nscalendar.datebyaddingunit(..., value:x, ...) i difference "fromdate" (created date or self) "todate" (current time nsdate()) using nscalendar.components(..., fromdate, todate, ....).minute if x>0, answer in step above x-1. if x<0, answer x. x defined in step 1 above. this has potential cause bugs in applications filter events using human readable attributes such events in past 3 hrs since 180 minutes not 3 hours due behavior. this not bug in step 1 since date prints correctly seen in printout @ end of post. is there option in nscalendar.components missing or bug? here code. // // nsdatetest.swift // nsdatetestcase // // created jitendra kulkarni on 6/13...