I have this code below and if I put the String.Format inside a if statement nothing gets rendered in the view. FYI - if I remove the semi colons from the if statements then there is a red line indicating error. This doesn't happen in the non if statement
@{
TimeSpan span = (ybEvent.UtcDate.AddDays(-1) - DateTime.UtcNow);
}
// this works
@String.Format("{0}d {1}hr {2}min", span.Days, span.Hours, span.Minutes)
// this doesn't work - does not render anything in view
@if (span.Days > 0)
{
String.Format("{0}d {1}hr {2}min", span.Days, span.Hours, span.Minutes);
} else
{
if (span.Hours > 0)
{
String.Format("{0}hr {1}min", span.Hours, span.Minutes);
} else
{
String.Format("{0}min", span.Minutes);
}
}