title: asp mvc format timespan (mm:ss) textboxfor to work with bootstrap timepicker
body: <p>I've read up on several posts with similar problems but still I can't get it to work properly. My problem is formating two timespan properties to mm:ss, and having them work with <a href="https://github.com/Eonasdan/bootstrap-datetimepicker" rel="nofollow">this</a> bootstrap datepicker correctly.</p>
  
  <p>The model properties: (Not sure if it's correct)</p>
  
  <pre><code>[DataType(DataType.Time)]
  [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = @"{0:mm\:ss}")]
  public TimeSpan AgentHoldoffTime { get; set; }
  
  [DataType(DataType.Time)]
  [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = @"{0:mm\:ss}")]
  public TimeSpan AgentAlertTime { get; set; }
  
  
  public InteractionQueueModel() // ctor
  {
       AgentAlertTime = new TimeSpan(0, 0, 17);
       AgentHoldoffTime = new TimeSpan(0, 2, 00);
  }
  </code></pre>
  
  <p>The view:</p>
  
  <pre><code>@Html.EditorFor(model =&gt; model.QueueModel.AgentHoldoffTime, new { htmlAttributes = 
  new { @class = "form-control timepicker-holdOffTime" } })
  
  @Html.EditorFor(model =&gt; model.QueueModel.AgentAlertTime, new { htmlAttributes = 
  new { @class = "form-control timepicker-alertTime" } })
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>var timePickerAlertTime = $(".timepicker-alertTime"),
      timePickerHoldOffTime = $(".timepicker-holdOffTime");
  
  timePickerAlertTime.datetimepicker({
          format: "mm:ss",
      })
      .on("dp.change", function () {
          ...
      });
  
  timePickerHoldOffTime.datetimepicker({
          format: "mm:ss",
      })
      .on("dp.change", function () {
          ...
      });
  </code></pre>
  
  <p>Now, when the view renders, a textbox displays <code>00:17</code> for a <code>time(7)</code> column with the value <code>00:00:17.0000000</code>. Everything seems fine, But when I submit <code>01:00</code> it's saved as <code>01:00:00.0000000</code> instead of <code>00:01:00.0000000</code>? I've probably missed something simple, but I can't figure it out.</p>
  
  <p>Thanks in advance.</p>