
/*
	NSCalendarDate: Short description plus relative dates like Today, Yesterday
	Original Source: <http://cocoa.karelia.com/Foundation_Categories/NSCalendarDate__Sho.m>
	(See copyright notice at <http://cocoa.karelia.com>)
*/

/*"	Return a short, localized description (using user preferences), or today/yesterday.
"*/

- (NSString *) relativeShortDescription
{
	NSString *result;

	int todayNum = [[NSCalendarDate calendarDate] dayOfCommonEra];
	int myNum = [self dayOfCommonEra];
	if (myNum == todayNum)
	{
		result = NSLocalizedString(@"Today",@"");
	}
	else if (myNum == (todayNum-1))
	{
		result = NSLocalizedString(@"Yesterday",@"");
	}
	else if (myNum == (todayNum+1))
	{
		result = NSLocalizedString(@"Tomorrow",@"");
	}
	else
	{
		NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
		NSString *outputFormat = [defaults objectForKey:@"NSShortDateFormatString"];
		result = [self descriptionWithCalendarFormat:outputFormat];
	}
	return result;
}