0
@Html.TextBoxFor(m => m.EndDate, new {
  @class = "disableFuturedate", @readonly = "readonly", @data_uk_datepicker = "{format: 'DD/MM/YYYY'}"
})

and also write into script

var currentDate = new Date();
$('.disableFuturedate').datepicker({
  maxDate: currentDate
}).on('changeDate', function(ev) {
  $(this).datepicker('hide');
});
$('.disableFuturedate').keyup(function() {
  if (this.value.match(/[^0-9]/g)) {
    this.value = this.value.replace(/[^0-9^-]/g, '');
  }
});
mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • Welcome to Stack Overflow! Visit the [help], take the [tour] to see what and [ask]. Please first ***>>>[Search for related topics on SO](https://www.google.com/search?q=disable+future+date+jqueryui+datepicker+site%3Astackoverflow.com)<<<*** and if you get stuck, post a [mcve] of your attempt, noting input and expected output using the [`[<>]`](https://meta.stackoverflow.com/questions/358992/ive-been-told-to-create-a-runnable-example-with-stack-snippets-how-do-i-do) snippet editor. – mplungjan Nov 18 '21 at 08:00
  • What is even the question here? – mplungjan Nov 18 '21 at 08:01

0 Answers0