WenchaoD / FSCalendar

A fully customizable iOS calendar library, compatible with Objective-C and Swift
MIT License
10.6k stars 1.94k forks source link

Show Islamic calendar #77

Closed mohsinalimat closed 8 years ago

mohsinalimat commented 9 years ago

Hello,

i want to show islamic calendar in your calendar demo.

how to show islamic calendar?

Thanks, Mohsinali Matiya

WenchaoD commented 9 years ago

Hi @mohsinalimat I didn't know much about islamic calendar. I've try to change the NSCalendar instance inside:

_calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSIslamicCalendar];
NSDateComponents *components = [_calendar components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay fromDate:[NSDate date]];
NSLog(@"%d,%d,%d",components.year,components.month,components.day);

But it prints 1436,11,25 as today. It seems that Islamic calendar is quite different.

mohsinalimat commented 9 years ago

Hi,

which screen i have to put above code? and what are the changes i have to made?

WenchaoD commented 9 years ago

In NSDate+FSExtension, there is a NSCalendar category. I've create the calendar instance with NSIslamicCalendar identifier, but there comes some issues after that change. Haven't got the time to find the reason yet.

WenchaoD commented 8 years ago

Hi @mohsinalimat I'm trying to adapt this to other calendar types, but here comes a weird problem that I can't figure out the reason. Could you explain this? image

mohsinalimat commented 8 years ago

Hello @WenchaoIOS

1437 = year 01 = month 30 = day

WenchaoD commented 8 years ago

That's not what I am asking. But still thanks

mohsinalimat commented 8 years ago

can you please send me code then i will check and find out solution?

WenchaoD commented 8 years ago

It's solved actually. Q is why 1437-1-1 adding 1 month resulting 1437-1-30 rather than 1437-2-1. It's turns out it's the problem of NSTimeZone. I'll push there changes ASAP and let the calendar identifier being skinnable.

WenchaoD commented 8 years ago

Fixed. To show a islamic calendar

_calendar.identifier = NSCalendarIdentifierIslamic;
mohsinalimat commented 8 years ago

Thanks your coding style is amazing... :+1:

mohsinalimat commented 8 years ago

on bug is found your latest code weekday bar days got wrong in your latest code....

WenchaoD commented 8 years ago

Sorry, fixed it.

mohsinalimat commented 8 years ago

:+1: again you are awsome