Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on iOS8 with RegionFormat set on UK and Date&Time 24-Hour Time disabled, mt_dateFromISOString returns null #58

Open
mdstage opened this issue May 5, 2015 · 1 comment

Comments

@mdstage
Copy link

mdstage commented May 5, 2015

On iOS8 (did not test other version, but it s probably also the case), if RegionFormat is set to UK and Date&Time 24-Hour disabled, mt_dateFromISOString returns null:

NSString *dateString = @"2017-12-31 23:00:00 GMT";
NSDate *premiumUntil = [NSDate mt_dateFromISOString:dateString];
NSLog(@"Date: %@", premiumUntil); // Date: (null)

By setting the locale in (NSDate *)mt_dateFromISOString:(NSString *)ISOString:

[formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]]];

it's working fine:

NSString *dateString = @"2017-12-31 23:00:00 GMT";
NSDate *premiumUntil = [NSDate mt_dateFromISOString:dateString];
NSLog(@"Date: %@", premiumUntil); // Date 2017-12-31 11:00:00 pm +0000

Note: as there is no Date&Time, this cannot be tested in the simulator, only on device

@mdstage mdstage changed the title on iOS8 with RegionFormat set on UK and Date&Time 24-Hour Time disabled, mt_dateFromISOString returns nill on iOS8 with RegionFormat set on UK and Date&Time 24-Hour Time disabled, mt_dateFromISOString returns null May 5, 2015
@yas375
Copy link
Contributor

yas375 commented May 5, 2015

@mdstage probably the same #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants