These are chat archives for revolter/JTCalendar

3rd
Apr 2015
Jonathan Tribouharet
@jonathantribouharet
Apr 03 2015 16:04
For the compare:date, I want to compare only the date (day, month, year) and not the datetime (hour, minutes). I know NSDateFormatter are slow, I didn't search another way to do it.
The loop while is used because NSDateComponents month property return an integer between 1 and 13 and I need an integer between 0 and 12 because standaloneMonthSymbols is an array. Also I tried to use module currentMonthIndex = currentMonthIndex % 12 but it doesn't work like I expected.
Iulian Onofrei
@revolter
Apr 03 2015 21:08
Then, if the month ranges from 1 to 13, doesn't that mean that it won't enter the while loop? Wouldn't it be easier to just subtract 1 from it, like NSInteger currentMonthIndex = comps.month - 1;?
Jonathan Tribouharet
@jonathantribouharet
Apr 03 2015 22:28
Sorry, I think I'm wrong in what I just said, there is an offset between month and standaloneMonthSymbols. And you're right, but be careful I remember there is a "trap" about this. I just copy past this code from another part in the lib where the while is useful.
Iulian Onofrei
@revolter
Apr 03 2015 22:39
A comment would have helped in this case, I'll try to figure out, maybe I can help optimize it without breaking it.
For the first thing, could this work? Also, i remember finding a method at work but I can't find it in the docs anymore, and I'm in vacation now.
Jonathan Tribouharet
@jonathantribouharet
Apr 03 2015 23:46
There is nothing to optimise in this case, the optimisation must be done on the view, I know what to do it just I don't have the time to work on it.