Need a way to ensure a complication counting down "X Days" will be correct after a time change

Originator:robotspacer
Number:rdar://25871645 Date Originated:22-Apr-2016 01:44 AM
Status:Open Resolved:
Product:watchOS Product Version:Any
Classification:Enhancement Reproducible:N/A
 
Summary:
I have a complication that uses CLKRelativeDateTextProvider to show a countdown to a particular day. I was able to accomplish that like this:

NSDate *date = [calendar endOfDayForDate:date];
template.textProvider = [CLKRelativeDateTextProvider textProviderWithDate:date style:CLKRelativeDateStyleNatural units:NSCalendarUnitDay];

The method endOfDayForDate: looks like this:

- (NSDate *)endOfDayForDate:(NSDate *)date {
	NSDate *startDate = [self startOfDayForDate:date];
	NSDateComponents *adjustment = [NSDateComponents new];
	adjustment.day = 1;
	adjustment.second = -1;
	return [self dateByAddingComponents:adjustment toDate:startDate options:0];
}

Configured this way, when the time reaches midnight, "5 days" becomes "4 days", and so on. It's pretty close to perfect. The one problem I've discovered is when the time zone changes. Because it's actually counting down to a specific second in time, if the time zone changes it's no longer counting down to the correct time.

If my extension runs, checks for a time zone change, and calls reloadTimelineForComplication: then I can update the templates with the new date. The problem is there's not any way to do that automatically.

Ideally, I'd love if I could configure CLKRelativeDateTextProvider to count down to a specific day, rather than a specific moment in time. Then watchOS could deal with time zone changes on its own. Alternatively, it would be extremely helpful to at least get notified when a time zone changes happens, so I have the opportunity to provide new data. For example, CLKComplicationDataSource could have an optional method named timeZoneDidChange that wakes up my extension as needed.

Steps to Reproduce:
N/A

Expected Results:
N/A

Actual Results:
N/A

Version:
Any

Notes:


Configuration:
Apple Watch 42mm

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!