We all know that Dates are something special. But Bernie's coworker thinks that also Hours are really special:
public IEnumerable<string> Hours
{
get
{
DateTimeFormatInfo dateTimeInfo = DateTimeFormatInfo.GetInstance(CultureInfo.CurrentCulture);
List<string> hours = new List<string>();
if (dateTimeInfo.DateSeparator == "/")
{
for (int i = 0; i < 10; i++)
{
hours.Add("0" + i + " AM");
}
for (int i = 10; i < 13; i++)
{
hours.Add(i + " AM");
}
for (int i = 1; i < 12; i++)
{
hours.Add(i + " PM");
}
}
else
{
for (int i = 0; i < 10; i++)
{
hours.Add("0" + i + ":00");
}
for (int i = 10; i < 24; i++)
{
hours.Add(i + ":00");
}
}
return hours;
}
}
Also note that he uses a DateSeparator to distinguish between hours with or without AM/PM. And while it is 02 AM, it is 2 PM. And 00 AM doesn't look so valid either...