Browse Source

Changes for seconds addition.

v1.2.4
Abhishek Banthia 8 years ago
parent
commit
c9b1b7470a
  1. 21
      Clocker/Model/CLTimezoneDataOperations.m

21
Clocker/Model/CLTimezoneDataOperations.m

@ -45,7 +45,16 @@
NSNumber *is24HourFormatSelected = [[NSUserDefaults standardUserDefaults] objectForKey:CL24hourFormatSelectedKey]; NSNumber *is24HourFormatSelected = [[NSUserDefaults standardUserDefaults] objectForKey:CL24hourFormatSelectedKey];
dateFormatter.dateFormat = is24HourFormatSelected.boolValue ? @"HH:mm" : @"hh:mm a"; NSNumber *showSeconds = [[NSUserDefaults standardUserDefaults] objectForKey:CLShowSecondsInMenubar];
if([showSeconds isEqualToNumber:@(0)])
{
dateFormatter.dateFormat = is24HourFormatSelected.boolValue ? @"HH:mm:ss" : @"hh:mm:ss a";
}
else
{
dateFormatter.dateFormat = is24HourFormatSelected.boolValue ? @"HH:mm" : @"hh:mm a";
}
dateFormatter.timeZone = [NSTimeZone timeZoneWithName:self.dataObject.timezoneID]; dateFormatter.timeZone = [NSTimeZone timeZoneWithName:self.dataObject.timezoneID];
//In the format 22:10 //In the format 22:10
@ -172,7 +181,7 @@
toDate:[NSDate date] toDate:[NSDate date]
options:kNilOptions]; options:kNilOptions];
NSDateFormatter *dateFormatter = [NSDateFormatter new]; NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.dateStyle = kCFDateFormatterShortStyle; dateFormatter.dateStyle = kCFDateFormatterLongStyle;
dateFormatter.timeStyle = kCFDateFormatterNoStyle; dateFormatter.timeStyle = kCFDateFormatterNoStyle;
dateFormatter.timeZone = [NSTimeZone timeZoneWithName:self.dataObject.timezoneID]; dateFormatter.timeZone = [NSTimeZone timeZoneWithName:self.dataObject.timezoneID];
@ -198,13 +207,11 @@
- (NSString *)getLocalCurrentDate - (NSString *)getLocalCurrentDate
{ {
NSDateFormatter *dateFormatter = [NSDateFormatter new]; NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.dateStyle = kCFDateFormatterShortStyle; dateFormatter.dateStyle = kCFDateFormatterLongStyle;
dateFormatter.timeStyle = kCFDateFormatterNoStyle; dateFormatter.timeStyle = kCFDateFormatterNoStyle;
dateFormatter.timeZone = [NSTimeZone systemTimeZone]; dateFormatter.timeZone = [NSTimeZone systemTimeZone];
return [NSDateFormatter localizedStringFromDate:[NSDate date] return [dateFormatter stringFromDate:[NSDate date]];
dateStyle:NSDateFormatterShortStyle
timeStyle:NSDateFormatterNoStyle];
} }
@ -293,8 +300,6 @@
{ {
/* A timezone has been selected*/ /* A timezone has been selected*/
NSLog(@"%@", self);
return; return;
} }

Loading…
Cancel
Save