Do not build headers from empty time stamps.
This commit is contained in:
parent
51bfdc760e
commit
6c9f003134
@ -30,15 +30,37 @@ namespace zaaReloaded2.Formatter
|
|||||||
{
|
{
|
||||||
#region Static methods
|
#region Static methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a header paragraph from a Date,
|
||||||
|
/// but only if the Date structure has a value.
|
||||||
|
/// </summary>
|
||||||
public static string DateHeader(DateTime date)
|
public static string DateHeader(DateTime date)
|
||||||
|
{
|
||||||
|
if (date != _nullTimeStamp.Date)
|
||||||
{
|
{
|
||||||
return FormatHeader(date.ToShortDateString());
|
return FormatHeader(date.ToShortDateString());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a header paragraph from a DateTime structure,
|
||||||
|
/// but only if the DateTime structure has a value.
|
||||||
|
/// </summary>
|
||||||
public static string DateAndTimeHeader(DateTime dateTime)
|
public static string DateAndTimeHeader(DateTime dateTime)
|
||||||
|
{
|
||||||
|
if (dateTime != _nullTimeStamp)
|
||||||
{
|
{
|
||||||
return FormatHeader(dateTime.ToString());
|
return FormatHeader(dateTime.ToString());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -119,5 +141,11 @@ namespace zaaReloaded2.Formatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
static readonly DateTime _nullTimeStamp = new DateTime();
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user