Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TKCalendarMonthView no longer supports Monday as the first weekday #13

Closed
muhku opened this issue Jul 26, 2010 · 11 comments
Closed

TKCalendarMonthView no longer supports Monday as the first weekday #13

muhku opened this issue Jul 26, 2010 · 11 comments

Comments

@muhku
Copy link

muhku commented Jul 26, 2010

In some regions Monday should be the first weekday. TKCalendarMonthView no longer supports this, in TKCalendarMonthView.h:

  • (id) initWithSundayAsFirst:(BOOL)sunday; // it sunday regardless right now...
@devinross
Copy link
Owner

I just haven't had time to implement this. Maybe you could help contribute? I kinda left a trail so it could be added in later.

@nihilenz
Copy link

I tried to change this way. It seems to work, but I advise you to check.

File: TKCalendarMonthView.m
There are two invocations of initWithMonth in which startDayOnSunday must be changed from YES to sunday (and then you can dinamically get the firstWeekday from current calendar and call initWithSundayAsFirst in init)

File: TKCalendarMonthTiles.m
I changed initWithMonth and rangeOfDatesInMonthGrid as http://gist.github.com/537603

@muhku
Copy link
Author

muhku commented Aug 22, 2010

@nihilenz: Thanks! I tested the change and I didn't find problems.

I made one further change. To make sure the calendar view is initialized by the current calendar format, change the init method of TKCalendarMonthView.m: http://gist.github.com/543456

@muhku
Copy link
Author

muhku commented Aug 22, 2010

All changes in one patch: http://gist.github.com/543469

Please review.

@muhku
Copy link
Author

muhku commented Aug 22, 2010

Sorry, more testing revealed the patch actually doesn't work. When touching a day, the month grid doesn't correctly calculate the day, which was selected. But let's see if I can fix it.

@nihilenz
Copy link

D'ho! I had not noticed at all...
I edited http://gist.github.com/537603 to add a modification to replace the lines [5-15] of reactToTouch

@muhku
Copy link
Author

muhku commented Aug 22, 2010

@nihilenz: Haha, I was about to submit a pretty similar fix ;-) Anyways, I'll make a new patch with your version...

@muhku
Copy link
Author

muhku commented Aug 22, 2010

@nihilenz: the following if

if(row==0 && column < firstWeekday-2){

doesn't change the previous month correctly if the first weekday of a month is Sunday (like now in August 2010).

I decided to use my own version, which looks a bit different, but feel free to make your own patch...

Anyways, the version which works for me is here: http://gist.github.com/543607

Please review again.

@nihilenz
Copy link

Right!
Your version works fine ;)

@devinross
Copy link
Owner

Good work! Do you know a way to easily merge these changes back into the framework?

@muhku
Copy link
Author

muhku commented Aug 22, 2010

@devinross: Just copy the patch to the root directory of the library and merge it:

patch -p1 < foo.diff

-p1 tells patch to ignore the first path element so it works in the root dir.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants