WenchaoD / FSCalendar

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

current date problem after change locale #144

Closed devAlikhani closed 8 years ago

devAlikhani commented 8 years ago

Hi I have a question about locale format of date, I want to convert this calendar to Persian calendar( I mean Solar Hijri calendar) then I use localIdentifier in viewDidLoad Function like this:

    calendar.locale = NSLocale(localeIdentifier: "fa_IR")

calendar is translated to Persian very good, but current date is not converted to Persian date, stay at Gregorian date, how can i translate or update current date to Persian?

WenchaoD commented 8 years ago

Hi @devAlikhani Can you show me what Persian calendar looks like? October 2015 .e.g.

WenchaoD commented 8 years ago

Sorry for my poor knowledge about calendars, but what is today in Persian calendar? I got it printed into console, it gives me 1394-8-19 image image

devAlikhani commented 8 years ago

oh no you are fantastic, this date is correct, today is 1394/8/19 in Persian calendar

WenchaoD commented 8 years ago

OK. I'll figure out a way to fix this.

devAlikhani commented 8 years ago

as a Persian Developer, I really thank you

WenchaoD commented 8 years ago

Fixed.

_calendar.identifier = NSCalendarIdentifierPersian;
emadhejazian commented 6 years ago

@devAlikhani I use this code line but my calendar is started from 1970,do you know why?

emadhejazian commented 6 years ago

I had this problem and I solved in this way: fsCalendar.locale = NSLocale(localeIdentifier: "fa_IR") as Locale fsCalendar.select(Date()) fsCalendar.identifier = NSCalendar.Identifier.persian.rawValue