title: Tempusdominus datetimepicker and ASP.NET MVC
body: <p>I try to use <a href="https://tempusdominus.github.io/bootstrap-4/" rel="nofollow noreferrer">https://tempusdominus.github.io/bootstrap-4/</a> in ASP.NET MVC project.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="input-group date" data-target-input="nearest"&gt;
         @Html.TextBoxFor(model =&gt; model.TimeEnd,
          new { @class = "form-control form-control-sm  datetimepicker-input", 
                  @data_toggle = "datetimepicker",
                 @data_target = "#TimeEnd",
                 type="text"
          })
        &lt;div class="input-group-append" data-target="#TimeEnd" data-toggle="datetimepicker"&gt;
       &lt;div class="input-group-text"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Where <code>model.TimeEnd</code> is string in the format <code>dd.MM.yyyy HH:mm</code></p>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$(document).ready(function () {
     $('#TimeEnd').datetimepicker({
        locale: 'es', 
      });
  });
  </code></pre>
  
  <p>When I open page the <code>input</code> <strong>has correct value</strong> but it is not visible in the <strong>datetimepicker</strong>. </p>
  
  <p><strong>UPDATE #1</strong></p>
  
  <p>If I set defaultDate via the same model  like  <code>defaultDate: '@Model.TimeEnd'</code> (where it is string in the format dd.MM.yyyy HH:mm) then the Spanish localization <strong>is gone</strong> and I see English calendar! Wow.
  And the following error appears</p>
  
  <blockquote>
    <p>moment-with-locales.min.js:1 Deprecation warning: value provided is
    not in a recognized RFC2822 or ISO format. moment construction falls
    back to js Date(), which is not reliable across all browsers and
    versions. Non RFC2822/ISO date formats are discouraged and will be
    removed in an upcoming major release. Please refer to
    <a href="http://momentjs.com/guides/#/warnings/js-date/" rel="nofollow noreferrer">http://momentjs.com/guides/#/warnings/js-date/</a> for more info.
    Arguments:  [0] _isAMomentObject: true, _isUTC: false, _useUTC: false,
    _l: undefined, _i: 14.08.2018 00:00, _f: null, _strict: false, _locale: [object Object] Error
        at Function.createFromInputFallback (<a href="http://localhost:62959/Scripts/moment-with-locales.min.js:1:3368" rel="nofollow noreferrer">http://localhost:62959/Scripts/moment-with-locales.min.js:1:3368</a>)
        at wa (<a href="http://localhost:62959/Scripts/moment-with-locales.min.js:1:21353" rel="nofollow noreferrer">http://localhost:62959/Scripts/moment-with-locales.min.js:1:21353</a>)
        at va (<a href="http://localhost:62959/Scripts/moment-with-locales.min.js:1:22064" rel="nofollow noreferrer">http://localhost:62959/Scripts/moment-with-locales.min.js:1:22064</a>)
        at Sa (<a href="http://localhost:62959/Scripts/moment-with-locales.min.js:1:22146" rel="nofollow noreferrer">http://localhost:62959/Scripts/moment-with-locales.min.js:1:22146</a>)
        at l (<a href="http://localhost:62959/Scripts/moment-with-locales.min.js:1:209" rel="nofollow noreferrer">http://localhost:62959/Scripts/moment-with-locales.min.js:1:209</a>)
        at k.i.getMoment (<a href="http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:14261" rel="nofollow noreferrer">http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:14261</a>)
        at k.i.defaultDate (<a href="http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:19874" rel="nofollow noreferrer">http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:19874</a>)
        at String. (<a href="http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:14947" rel="nofollow noreferrer">http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:14947</a>)
        at Function.each (<a href="http://localhost:62959/Scripts/jquery-3.3.1.js:360:19" rel="nofollow noreferrer">http://localhost:62959/Scripts/jquery-3.3.1.js:360:19</a>)
        at k.i.options (<a href="http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:14895" rel="nofollow noreferrer">http://localhost:62959/Scripts/tempusdominus-bootstrap-4.min.js:6:14895</a>)</p>
  </blockquote>
  
  <p>Any clue how to fix this issue?</p>