Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular-Material DateTime Picker Component?

I imported a date picker in a project and was wondering if there was any official recent component from angular and material to include time in the calendar as well.
I've seen plenty of time pickers in material documentation and researched a lot of third party ones, but they seem very complex.

like image 510
Kevin Curnow Avatar asked Feb 06 '18 18:02

Kevin Curnow


People also ask

Does angular material have time picker?

Using Datepicker with Time SelectionThe @angular-material-components/datetime-picker package provides components to add Datepicker with Time selection capabilities.

How can use Datepicker in angular materials?

mat-datepicker exampleAdd a template reference variable mat-datepicker element. Connect mat-datepicker to input element via [matDatepicker] property. Finally add date picker toggle button to display or hide calender popup by using mat-datepicker-toggle element.

How can I get mat Datepicker value?

To use Datepicker in our application, we need to import MatDatepickerModule in application module. On this page we will create Datepicker and fetch selected value using NgModel , FormControl and FormGroup .

What is dateA11yLabel?

The dateA11yLabel and monthYearA11yLabel is for Accessibility(A11Y). The Accessibility (a11y) project is community driven effort to make web accessibility easier for the all people including those with disabilities or impairments.


2 Answers

You can have a datetime picker when using matInput with type datetime-local like so:

  <mat-form-field>     <input matInput type="datetime-local" placeholder="start date">   </mat-form-field> 

You can click on each part of the placeholder to set the day, month, year, hours,minutes and whether its AM or PM.

like image 193
Maurice Avatar answered Oct 05 '22 12:10

Maurice


I recommend you to checkout @angular-material-components/datetime-picker. This is a DatetimePicker like @angular/material Datepicker by adding support for choosing time.

enter image description here

like image 41
hqho Avatar answered Oct 05 '22 12:10

hqho