I have a Parse data definition Date input field on my app. I've also added a label (number of days) to the primary cell of the SCArrayOfObjects cell - STV 4.05. I've assigned a tag of 60 to the label. After the user selects/inputs a date on the app, I want to perform a calendar calculation on the user's inputed date to determine how many days there are between the user's selected date and the current date.
After the calculation has been performed, I want to display the results/number of days between user's selected date and the current date on the label I've created with a tag of 60.
However, I'm having issues trying to produce the proper code to start the process of performing calendar calculations on the Parse "Date" definition field. The code I've started with below has issues - doesn't appear to work with STV 4.05:
SCPropertyDefinition *date = [accountInfo propertyDefinitionWithName:@"date"];
dueDate.cellActions.willDisplay = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
NSDate *startDate = [NSDate date];
NSDate *endDate = [formatter dateFromString:@"dueDate"];
NSCalendar *gregorian = [[NSCalendar alloc]
NSUInteger unitFlags = NSCalendarUnitDay;
NSDateComponents *components = [gregorian components:unitFlags
NSInteger day = [components day];
NSLog(@"Days between %@ and %@ is: %ld", startDate, endDate, (long)[components day]);
Please let me know if you have any suggestions.