Closed babakmuir closed 5 years ago
without seeing code of your
I cannot help.
func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {
dateFotmatter.dateFormat = "yyyy/MM/dd"
dateFotmatter.timeZone = persianCalendar.timeZone
dateFotmatter.locale = persianCalendar.locale
let startDate = dateFotmatter.date(from: "1397/04/01")!
let endDate = dateFotmatter.date(from: "1420/01/01")!
// let startDate = testFotmatter.date(from: "2017 01 01")!
// let endDate = testFotmatter.date(from: "2017 12 31")!
let parameters = ConfigurationParameters(startDate: startDate,
endDate: endDate,
numberOfRows: 6,
calendar: persianCalendar,
generateInDates: .forAllMonths,
generateOutDates: .tillEndOfGrid,
firstDayOfWeek: .saturday)
return parameters
}
func calendar(_ calendar: JTAppleCalendarView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTAppleCell {
let cell = calendar.dequeueReusableJTAppleCell(withReuseIdentifier: "CustomCell", for: indexPath) as! CustomCell
cell.dateLabel.text = cellState.text
handleCellSelected(view: cell, cellState: cellState)
handleCellTextColor(cell: cell, cellState: cellState)
return cell
I need it to use Persian words and numbers for example I need اردیبهشت but it shows Ordibehesht in month label the same for numbers ۱۲۳...۸۹۰ instead of 123...890
so basically you are saying that you want persian language like
اردیبهشت
but instead you are getting english like this?
1 2 3
What you are asking isnt really a JTApplecalendar problem. You just need to know how to use date formatter to convert dates into Persian.
Here is how to do it.
let date = Date()
let df = DateFormatter()
df.locale = Locale(identifier: "fa_IR")
df.calendar = persianCalendar
df.dateFormat = "dd"
print(df.string(from: date))
Tell me if this works.
Thanks a lot man it worked pretty well I'm new to Xcode and sorry for the obvious question looking forward to learn more
cool
IMPORTANT - BEFORE CREATING YOUR ISSUE PLEASE READ THE FOLLOWING: