-
Notifications
You must be signed in to change notification settings - Fork 814
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
Option for Persian/Jalali Calendar? #173
Comments
It is ok. You can do this in two ways. Pick one.
|
I choose 1, because I made change static JTAppleCalendarSwift.swift var cal = Calendar(identifier: .gregorian) to: var cal = Calendar(identifier: .persian) It's Changed calendar to Persian. To change it from LeftToRight to RightToLeft: JTAppleCalendarSwift.swift var scalingTransform : CGAffineTransform!
scalingTransform = CGAffineTransform(scaleX: -1, y: 1);
cv.transform = scalingTransform and in ViewController in calendar func add this lines end of function: var scalingTransform : CGAffineTransform!
scalingTransform = CGAffineTransform(scaleX: -1, y: 1);
myCustomCell.transform = scalingTransform I don't have any idea how you want make it dynamic and switchable. |
Thanks for the code help. Let me think on this. If I cant do it in code, I will add your post as a tutorial. Thanks! |
U welcome buddy, Thanks to your nice job. 👍 |
Ok, i cant read your calendar. But is every thing ok with it? If all is well, then great! Also, I have found a way to add it to the code. |
Yes, I checked a year with time.ir (Persian data/time reference) calendar and It's correct. |
Awesome. |
HoHaa 🗡 var scalingTransform : CGAffineTransform!
scalingTransform = CGAffineTransform(scaleX: -1, y: 1);
headerCell?.transform = scalingTransform in end of too. So this cell will be mirrored and will be done :D |
Hey, so I made an update specially for you. 😎 Ensure you save your changes first because doing a To test the new feature, do the following:
To use is all you have to do is this:
|
@vahids Let me know if it works. If it works, then you can remove your code. |
Yes working like charm, Great Work! Thanks again. 👍 |
You have dates. When ever you scroll the calendar, this delegate function is called func calendar(_ calendar: JTAppleCalendarView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo) With this function you have a variable called If you need help, then let me know. |
I found it, but it return Gregorian dates. I know I can convert it to Persian and find the month name. |
is it returning gregorian dates even though you used Are you talking about the sample application? OR Are you talking about your app? The thing is, I do not know any thing about Persian dates. |
I use .persian in configureCalendar > parameters > calendar but It print gregorian date func calendar(_ calendar: JTAppleCalendarView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo){
print(visibleDates.monthDates)
} BTW, It's easy to convert with DateFormatter |
ok do you know how to print a persian date? I thought that when ever you do this --> let aDate = Date() I thought you only got one type of dates. I did not know there is a way to return Persian dates. If you know of a way to return Persian dates, then let me know. Or I can try researching it because I do not know how. |
You right there is not any type or return Persian Date. let today = visibleDates.monthDates[1]
let persian = Calendar(identifier: .persian)
let formatter = DateFormatter()
formatter.dateStyle = DateFormatter.Style.long
formatter.calendar = persian as Calendar!
formatter.locale = NSLocale(localeIdentifier: "fa_IR") as Locale! // "fa_IR" stands for Persian "ar_??" stands for Islamic ...
formatter.dateFormat = "MMMM"
let date = formatter.string(from: today as Date)
print(date) |
Cool cool. So all is well now? :D ? |
Yes, Thank YOU! |
awesome |
hmm.. new issue 😄 |
xD ... i didnt think about that |
Yes it is ok to change to code in the framework. If I do not know your code change, then future versions will not have your On Fri, Oct 21, 2016 at 5:15 AM, Vahid [email protected] wrote:
|
@vahids I just made a change. Let me know if orientation bug is now resolved. |
I don't know what's going on /Users/vahid/Desktop/PersianCal/Pods/JTAppleCalendar/Sources/JTAppleCalendarView.swift:848:48: Binary operator '>=' cannot be applied to operands of type 'Date' and 'Date!' this line of code: So, I could not test direction. |
Oh. Yea. that is an XCode 8 bug. They mentioned this in their release notes. |
Did not want to make a new issue but it seems |
ah. Nevermind I see |
Did u changed something again? I can't use |
@AwesDea it is been changed to a final name that i will not change again. I have changed it to the same name as the one inside a UICOollectionView. This helps everyone in that they would not have to remember any custom names that i makeup anymore. The name of the variable under the UICOllectionView is this -> calendarView.semanticContentAttribute = .... This is now the same name provided by Apple |
hey |
@AtrinNoori you also have to give the library a calendar instance setup for persian. let myCalendar = Calendar(identifier: .persian)
myCalendar.timeZone = ....
myCalendar.locale = ....
let params = ConfigurationParameters(startDate: startDate, endDate: endDate, calendar: myCalendar) |
How can I use the |
@mohammad19991 calendarView.semanticContentAttribute ? I think that is the name of the variable for UICollectionsViews |
yea I ended up using |
I made some change in source code and It's changed to Persian calendar and Right to Left.
I just want to know is it OK if I change some code in this framework?
The text was updated successfully, but these errors were encountered: