From the course: Building Angular and Django Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Date/time selection with a Calendar in Angular

Date/time selection with a Calendar in Angular

From the course: Building Angular and Django Apps

Start my 1-month free trial

Date/time selection with a Calendar in Angular

- [Instructor] The material datepicker has an interesting architecture. It lets you choose what type of date and time objects it will use. The two options are NativeDateModule and MomentDateModule. Native uses the data objects built into the browser, while moment uses the moment.js library. We're going to be using the NativeDateModule. We open up the create-tour-form-component and go to the Starts On field, and the start date will be using the matDatepicker, which will point to the Starts On datepicker. And then we're going to actually create the toggle button for the datepicker. And again it will be pointing to the Starts On datepicker. And now we create the actual datepicker, and the Starts On datepicker is the element reference here. And that's all there is to it. Let's run the dev servers, and let's see how it looks in the browser. As you can see the date formatting has changed, and we're able to use the datepicker…

Contents