Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

ngbdatepicker disable input

<h1>Disabling and limiting dates</h1>
<!-- You can limit the dates available for navigation and selection using [minDate] and [maxDate] inputs. If you don't specify any of them, you'll have infinite navigation and the year select box will display [-10, +10] years from currently visible month. -->
<!-- If you want to disable some dates for selection (ex. weekends), you have to provide the [markDisabled] function that will mark certain dates not selectable. It will be called for each newly visible day when you navigate between months. -->
<!-- ex. disable the 13th of each month -->

<script>
const isDisabled = (date: NgbDate, current: {month: number}) => date.day === 13;
</script>

<ngb-datepicker [minDate]="{year: 2010, month: 1, day: 1}"
                [maxDate]="{year: 2048, month: 12, day: 31}"
                [markDisabled]="isDisabled">
</ngb-datepicker>
Source by ng-bootstrap.github.io #
 
PREVIOUS NEXT
Tagged: #ngbdatepicker #disable #input
ADD COMMENT
Topic
Name
7+7 =