public static string GetHelpHtml( DateTime currentDateTime )
{
SlidingDateRangePicker helperPicker = new SlidingDateRangePicker();
SlidingDateRangeType[] slidingDateRangeTypesForHelp = new SlidingDateRangeType[] { SlidingDateRangeType.Current, SlidingDateRangeType.Previous, SlidingDateRangeType.Last, SlidingDateRangeType.Next, SlidingDateRangeType.Upcoming };
string helpHtml = @"
<div class='slidingdaterange-help'>
<p>A date range can either be a specific date range, or a sliding date range based on the current date and time.</p>
<p>For a sliding date range, you can choose either <strong>current, previous, last, next, upcoming</strong> with a time period of <strong>hour, day, week, month, or year</strong>. Note that a week is Monday thru Sunday.</p>
<br />
<ul class=''>
<li><strong>Current</strong> - the time period that the current date/time is in</li>
<li><strong>Previous</strong> - the time period(s) prior to the current period (does not include the current time period). For example, to see the most recent weekend, select 'Previous 1 Week'</li>
<li><strong>Last</strong> - the last X time period(s) including the current until today. For example, to see so far this current week and prior week, select 'Last 2 weeks'</li>
<li><strong>Next</strong> - the next X time period(s) including the rest of the current period. For example, to see the rest of the current month and the next full month after, select 'Next 2 months'</li>
<li><strong>Upcoming</strong> - the upcoming X time period(s) not including the current time period.</li>
</ul>
<h3>Preview of the sliding date ranges</h3>";
foreach ( var slidingDateRangeType in slidingDateRangeTypesForHelp )
{
helperPicker.SlidingDateRangeMode = slidingDateRangeType;
helperPicker.NumberOfTimeUnits = 2;
StringBuilder sb = new StringBuilder();
sb.AppendFormat( @"<h4>{0}</h4>", slidingDateRangeType.ConvertToString() );
sb.AppendLine( "<ul>" );
foreach ( var timeUnitType in Enum.GetValues( typeof( TimeUnitType ) ).OfType<TimeUnitType>() )
{
helperPicker.TimeUnit = timeUnitType;
sb.AppendFormat( @"
<li>
<span class='slidingdaterange-help-key'>{0} {1}</span>
<span class='slidingdaterange-help-value'> - {2}</span>
</li>",
slidingDateRangeType != SlidingDateRangeType.Current ? helperPicker.NumberOfTimeUnits.ToString() : string.Empty,
helperPicker.TimeUnit.ConvertToString().PluralizeIf( slidingDateRangeType != SlidingDateRangeType.Current && helperPicker.NumberOfTimeUnits > 1 ),
SlidingDateRangePicker.CalculateDateRangeFromDelimitedValues( helperPicker.DelimitedValues ).ToStringAutomatic() );
}
sb.AppendLine( "</ul>" );
helpHtml += sb.ToString();
}
helpHtml += @"
</div>
";
return helpHtml;
}