DateInputComponent
Represents the Kendo UI DateInput component for Angular.
Selector
kendo-dateinput
Export Name
Accessible in templates as #kendoDateInputInstance="kendo-dateinput"
Inputs
disabled
boolean
Sets or gets the disabled
property of the DateInput and
determines whether the component is active
(see example).
format
string | FormatSettings
Specifies the date format that is used to display the input value (see example).
Format value options:
string
- Provide astring
if a single format is going to be used regardless whether the input is focused or blurred.FormatSettings
- To display different formats when the component is focused or blurred, provide a settings object with specifiedinputFormat
anddisplayFormat
values.
formatPlaceholder
Defines the descriptions of the format sections in the input field. For more information, refer to the article on placeholders.
@Component({
selector: 'my-app',
template: `
<div class="row example-wrapper" style="min-height: 450px;">
<div class="col-xs-12 col-md-6 example-col">
<p>Full-length format description:</p>
<kendo-dateinput formatPlaceholder="wide"></kendo-dateinput>
</div>
<div class="col-xs-12 col-md-6 example-col">
<p>Narrow-length format description:</p>
<kendo-dateinput formatPlaceholder="narrow"></kendo-dateinput>
</div>
<div class="col-xs-12 col-md-6 example-col">
<p>Short-length format description:</p>
<kendo-dateinput formatPlaceholder="short"></kendo-dateinput>
</div>
<div class="col-xs-12 col-md-6 example-col">
<p>Display defined format:</p>
<kendo-dateinput format="MM/dd/yyyy" formatPlaceholder="formatPattern"></kendo-dateinput>
</div>
<div class="col-xs-12 col-md-6 example-col">
<p>Custom defined format descriptions</p>
<kendo-dateinput format="G"
[formatPlaceholder]="{
year: 'y', month: 'M', day: 'd',
hour: 'h', minute: 'm', second: 's'
}"
></kendo-dateinput>
</div>
</div>
`
})
export class AppComponent { }
incompleteDateValidation
boolean
Determines whether the built-in validation for incomplete dates is to be enforced when a form is being validated.
max
Date
Specifies the biggest date that is valid
(see example).
By default, the max
value is 2099-12-31
.
min
Date
Specifies the smallest date that is valid
(see example).
By default, the min
value is 1900-1-1
.
placeholder
string
Specifies the hint the DateInput displays when its value is null
.
For more information, refer to the article on
placeholders.
@Component({
selector: 'my-app',
template: `
<kendo-dateinput placeholder="Enter birth date..."></kendo-dateinput>
`
})
export class AppComponent { }
rangeValidation
boolean
Determines whether the built-in min or max validators are to be enforced when a form is being validated.
readonly
boolean
Sets or gets the read-only state of the DateInput (see example).
spinners
boolean
Specifies whether the Up and Down spin buttons will be rendered. For more information, refer to the article on spinner buttons.
steps
Configures the incremental steps of the DateInput. For more information, refer to the article on incremental steps.
@Component({
selector: 'my-app',
template: `
<kendo-dateinput [steps]="steps"></kendo-dateinput>
`
})
export class AppComponent {
public steps = { year: 10, month: 1, day: 5 };
}
tabindex
number
Sets or gets the tabIndex
property of the DateInput.
.
title
string
Sets the title of the input element of the DateInput.
twoDigitYearMax
number
The maximum year to assume to be from the current century when typing two-digit year value (see example).
The default value is 68, indicating that typing any value less than 69 will be assumed to be 20xx, while 69 and larger will be assumed to be 19xx.
fillMode
Sets the fillMode of the component.
The possible values are:
solid
(Default)flat
outline
none
rounded
Sets the border radius of the component.
The possible values are:
small
medium
(Default)large
full
none
size
Sets the size of the component.
The possible values are:
small
medium
(Default)large
none
value
Date
Specifies the value of the DateInput component.
The
value
has to be a valid JavaScriptDate
instance.
Events
blur
EventEmitter<null>
Fires each time the input element gets blurred. For more information, refer to the section on events.
To wire the event programmatically, use the
onBlur
property.
@Component({
selector: 'my-app',
template: `
<kendo-dateinput (blur)="handleBlur()"></kendo-dateinput>
`
})
export class AppComponent {
public handleBlur(): void {
console.log("Component is blurred");
}
}
focus
EventEmitter<null>
Fires each time the user focuses the input element. For more information, refer to the section on events.
To wire the event programmatically, use the
onFocus
property.
@Component({
selector: 'my-app',
template: `
<kendo-dateinput (focus)="handleFocus()"></kendo-dateinput>
`
})
export class AppComponent {
public handleFocus(): void {
console.log("Component is focused");
}
}
valueChange
EventEmitter<Date>
Fires each time the user selects a new value. For more information, refer to the section on events.
Methods
blur
Blurs the DateInput component.
focus
Focuses the DateInput component.
@Component({
selector: 'my-app',
template: `
<button (click)="dateinput.focus()">Focus date input</button>
<kendo-dateinput #dateinput></kendo-dateinput>
`
})
export class AppComponent { }