Fix a wrong bis-check.
This commit is contained in:
parent
ded605f18a
commit
a7c0f50422
|
|
@ -28,7 +28,7 @@
|
|||
self.formatter.calendar = self.chineseCalendar;
|
||||
self.formatter.dateFormat = @"M";
|
||||
self.lunarDays = @[@"初二",@"初三",@"初四",@"初五",@"初六",@"初七",@"初八",@"初九",@"初十",@"十一",@"十二",@"十三",@"十四",@"十五",@"十六",@"十七",@"十八",@"十九",@"二十",@"二一",@"二二",@"二三",@"二四",@"二五",@"二六",@"二七",@"二八",@"二九",@"三十"];
|
||||
self.lunarMonths = @[@"一月",@"二月",@"三月",@"四月",@"五月",@"六月",@"七月",@"八月",@"九月",@"十月",@"冬月",@"腊月"];
|
||||
self.lunarMonths = @[@"正月",@"二月",@"三月",@"四月",@"五月",@"六月",@"七月",@"八月",@"九月",@"十月",@"冬月",@"腊月"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
// First day of month
|
||||
NSString *monthString = [self.formatter stringFromDate:date];
|
||||
if (![monthString containsString:@"bis"]) {
|
||||
if ([self.chineseCalendar.veryShortMonthSymbols containsObject:monthString]) {
|
||||
return self.lunarMonths[monthString.integerValue-1];
|
||||
}
|
||||
// Leap month
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ open class LunarFormatter: NSObject {
|
|||
fileprivate let chineseCalendar = Calendar(identifier: .chinese)
|
||||
fileprivate let formatter = DateFormatter()
|
||||
fileprivate let lunarDays = ["初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","二一","二二","二三","二四","二五","二六","二七","二八","二九","三十"]
|
||||
fileprivate let lunarMonths = ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","冬月","腊月"]
|
||||
fileprivate let lunarMonths = ["正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","冬月","腊月"]
|
||||
|
||||
|
||||
override init() {
|
||||
|
|
@ -28,7 +28,7 @@ open class LunarFormatter: NSObject {
|
|||
}
|
||||
// First day of month
|
||||
let monthString = self.formatter.string(from: date)
|
||||
if !monthString.contains("bis") {
|
||||
if self.chineseCalendar.veryShortMonthSymbols.contains(monthString) {
|
||||
if let month = Int(monthString) {
|
||||
return self.lunarMonths[month-1]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue