Skip to content

Commit

Permalink
Release 4.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jg zhu committed Mar 23, 2022
1 parent b771abd commit 24dba39
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SensorsAnalyticsSDK"
s.version = "4.2.4"
s.version = "4.2.5"
s.summary = "The official iOS SDK of Sensors Analytics."
s.homepage = "http://www.sensorsdata.cn"
s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" }
Expand Down
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/Core/SensorsAnalyticsSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#import "SAUserDefaultsStorePlugin.h"
#import "SASessionProperty.h"

#define VERSION @"4.2.4"
#define VERSION @"4.2.5"

void *SensorsAnalyticsQueueTag = &SensorsAnalyticsQueueTag;

Expand Down
1 change: 1 addition & 0 deletions SensorsAnalyticsSDK/Core/Utils/SADateFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ + (NSDateFormatter *)dateFormatterFromString:(NSString *)string {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
});
if (dateFormatter) {
[dateFormatter setDateFormat:string];
Expand Down
18 changes: 18 additions & 0 deletions SensorsAnalyticsTests/Utils/SADateFormatterTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ - (void)testDateFormatterWithNilString {
// NSString *current = [dateFormatter stringFromDate:[NSDate date]];
}

- (void)testLocaleIdentifier {
// 修复 iOS 15.4 中国大陆地区在 12 小时制格式化日期时包含 AM/PM 问题
NSDateFormatter *dateFormatter = [SADateFormatter dateFormatterFromString:@""];
XCTAssertTrue([dateFormatter.locale.localeIdentifier isEqualToString:@"en_US_POSIX"]);
}

- (void)testDateFormatter {
NSString *formatter = @"yyyy-MM-dd HH:mm:ss";
NSDateFormatter *dateFormatter = [SADateFormatter dateFormatterFromString:formatter];
XCTAssertTrue([dateFormatter.dateFormat isEqualToString:formatter]);
}

-(void)testDateFromString {
NSDateFormatter *dateFormatter = [SADateFormatter dateFormatterFromString:@"yyyy-MM-dd HH:mm:ss"];
NSString *dateString = @"2022-03-21 18:07:09";
XCTAssertNotNil([dateFormatter dateFromString:dateString]);
}

- (void)testDateFormatterWithNotDateFormatterString {
NSDateFormatter *dateFormatter = [SADateFormatter dateFormatterFromString:@"jjjj"];
NSString *current = [dateFormatter stringFromDate:[NSDate date]];
Expand Down

0 comments on commit 24dba39

Please sign in to comment.