12345678910111213141516171819202122232425 |
- import { Component } from '@angular/core';
- import { NativeInputComponent } from '../../_abstract/native-input.component';
- @Component({
- selector: 'app-datepicker',
- templateUrl: './datepicker.component.html',
- styleUrls: ['./datepicker.component.scss']
- })
- export class ClrDatepickerComponent extends NativeInputComponent {
- exposeMetaInTemplate: string[] = ['extraClass', 'placeholder'];
- ngOnInit() {
- super.ngOnInit();
-
- // CLarity datepicker expects a string when used reactively
- const dateObj = this.control.value;
- const d = dateObj.getDate();
- const m = dateObj.getMonth();
- const y = dateObj.getFullYear();
- this.control.setValue(`${d}/${m + 1}/${y}`);
- }
- }
|