Datetimepicker considering day as month

Asked

Viewed 88 times

0

I have an inputText that I created for date, it is initially filled with a Datetime of my Model that is populated:

@Html.TextBoxFor(model => model.Data, "{0:dd/MM/yyyy}", new { @class = "form-control input-md", @id = "datetimepickerDataFato" })

And my datetimepicker javascript

$(document).ready(function () {
  $('#datetimepickerDataFato').datetimepicker({
     locale: 'pt-br',
     format: 'DD/MM/YYYY',
     allowInputToggle: true,
     maxDate: Date.now()
  });
});

My problem is that when this javascript code of the datetimepicker is read, it overwrites my date to today, and still considers the day as if it were month, ie I can not put any day that is bigger than 12.

  • Do you have 'en' in your locale file? You also tried to include language: 'pt'?

  • @Ricardopunctual It has the 'en' in locale yes. I tried to do the language scheme but it also did not work

1 answer

0

Try using the following format: 'dd/MM/yyyy' in your javascript.

  • I tried, but he brings the ordinal of the day of the week, like Thursday, Friday

  • This is already in the datapicker, what do you mean by "in your javascript"? The datapicker code is already in javascript, confusing and superficial response, put more details and an example of code. The actual content of your reply could be a simple comment.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.