public static MvcHtmlString TimePicker(this HtmlHelper helper, string name, bool formGroup, string value, string dateFormat, IDictionary <string, object> htmlProps = null)
{
if (dateFormat.Contains("f") || dateFormat.Contains("F"))
{
htmlProps["class"] += " form-control";
return(helper.TextBox(TypeContextUtilities.Compose(name, "Time"), value, htmlProps));
}
var input = new HtmlTag("input")
.IdName(name)
.Attr("type", "text")
.Class("form-control")
.Attrs(htmlProps)
.Attr("value", value);
if (!formGroup)
{
return(AttachTimePiceker(input, dateFormat));
}
HtmlStringBuilder sb = new HtmlStringBuilder();
using (sb.SurroundLine(AttachTimePiceker(new HtmlTag("div").Class("input-group time"), dateFormat)))
{
sb.Add(input);
using (sb.SurroundLine(new HtmlTag("span").Class("input-group-addon")))
sb.Add(new HtmlTag("span").Class("glyphicon glyphicon-time"));
}
return(sb.ToHtml());
}