Skip to content

Commit

Permalink
Explicitly set a default time zone to get force install after date to…
Browse files Browse the repository at this point in the history
… display correctly. GitHub #150.
  • Loading branch information
hjuutilainen committed Sep 20, 2017
1 parent a0335c3 commit 8818d34
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions MunkiAdmin/UI Controllers/MAAdvancedPackageEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ - (NSModalSession)beginEditSessionWithObject:(PackageMO *)aPackage delegate:(id)
self.delegate = modalDelegate;
[self.mainTabView selectTabViewItemAtIndex:0];

// Set the force_install_after_date date picker to use UTC
NSTimeZone *timeZoneUTC = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[gregorian setTimeZone:timeZoneUTC];
[self.forceInstallDatePicker setCalendar:gregorian];
[self.forceInstallDatePicker setTimeZone:timeZoneUTC];
[self updateDatePickerTimeZone];

[self setDefaultValuesFromPackage:self.pkginfoToEdit];

Expand Down Expand Up @@ -768,6 +763,17 @@ - (void)updateIconNameComboBoxAutoCompleteList
self.iconNameSuggestions = newIconNameSuggestions;
}

- (void)updateDatePickerTimeZone
{
// Set the force_install_after_date date picker to use UTC (don't try to display it in some other time zone)
NSTimeZone *timeZoneUTC = [NSTimeZone timeZoneWithName:@"UTC"];
[NSTimeZone setDefaultTimeZone:timeZoneUTC];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[gregorian setTimeZone:timeZoneUTC];
[self.forceInstallDatePicker setCalendar:gregorian];
[self.forceInstallDatePicker setTimeZone:timeZoneUTC];
}


- (void)windowDidLoad
{
Expand Down Expand Up @@ -853,12 +859,7 @@ - (void)windowDidLoad
[self updateIconNameComboBoxAutoCompleteList];
[self.iconNameComboBox setDelegate:self];

// Set the force_install_after_date date picker to use UTC
NSTimeZone *timeZoneUTC = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[gregorian setTimeZone:timeZoneUTC];
[self.forceInstallDatePicker setCalendar:gregorian];
[self.forceInstallDatePicker setTimeZone:timeZoneUTC];
[self updateDatePickerTimeZone];

[self setDefaultValuesFromPackage:self.pkginfoToEdit];

Expand Down

0 comments on commit 8818d34

Please sign in to comment.