You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My iPhone's language is Chinese, but when I run this code, weekdayName is english
guard let date = @"2017-12-29".date(format:.custom("yyyy-MM-dd"), fromRegion:Region.Local())else{return}// name is Fri, but I expect is 周五varname= date.weekdayShortName
The text was updated successfully, but these errors were encountered:
Since SwiftDate 5.x you can use weekDayName function and you can override the current locale of the date (>=5.12):
letregion=Region(calendar:Calendars.gregorian, zone:Zones.europeLondon, locale:Locales.chinese)letdate="2017-12-29".toDate("yyyy-MM-dd", region: region)letstring= date?.weekdayName(.short, locale:Locales.english)// you can specify the output locale directly
malcommac
changed the title
Region.Local() is based on the device language to determine it?
weekdayName(), eraName(), quarterName() can now specify locale overwrite to region's locale
Oct 26, 2018
malcommac
changed the title
weekdayName(), eraName(), quarterName() can now specify locale overwrite to region's locale
weekdayName(), eraName(), quarterName() allows to specify locale overwrite to region's locale
Oct 26, 2018
My iPhone's language is Chinese, but when I run this code, weekdayName is english
The text was updated successfully, but these errors were encountered: