Add text-mask on date fields.
This commit is contained in:
parent
931ef38f29
commit
c546cbf833
@ -56,6 +56,7 @@
|
||||
"angular-messages": "^1.6.5",
|
||||
"angular-resource": "^1.6.5",
|
||||
"angular-strap": "^2.3.12",
|
||||
"angular2-text-mask": "^8.0.2",
|
||||
"base64util": "^1.0.2",
|
||||
"bootbox": "^4.4.0",
|
||||
"bootstrap": "4.0.0-alpha.6",
|
||||
|
@ -9,6 +9,7 @@ import { RestangularModule } from 'ngx-restangular';
|
||||
import { NgLoggerModule, Level } from '@nsalaun/ng-logger';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { TextMaskModule } from 'angular2-text-mask';
|
||||
|
||||
import { ScheduleService } from './schedule.service';
|
||||
import { ScheduleDeleteModalComponent } from './scheduleDeleteModal.component';
|
||||
@ -33,7 +34,8 @@ export function accountIdServiceFactory(i: any) {
|
||||
NgLoggerModule,
|
||||
RestangularModule,
|
||||
ToastrModule,
|
||||
NgbModule
|
||||
NgbModule,
|
||||
TextMaskModule
|
||||
],
|
||||
providers: [
|
||||
ScheduleService,
|
||||
|
@ -15,8 +15,7 @@ import { Schedule } from './schedule';
|
||||
<label class="col-sm-4 control-label" for="start-date">Date de début</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" id="start-date" name="start_date"
|
||||
type="text" [(ngModel)]="schedule.start_date"
|
||||
bs-datepicker data-date-format="yyyy-MM-dd" data-timezone="UTC"
|
||||
[(ngModel)]="schedule.start_date" [textMask]="{mask: dateMask}"
|
||||
placeholder="Schedule start date">
|
||||
</div>
|
||||
</div>
|
||||
@ -25,8 +24,7 @@ import { Schedule } from './schedule';
|
||||
<label class="col-sm-4 control-label" for="stop-date">Date de fin</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" id="stop-date" name="stop_date"
|
||||
type="text" [(ngModel)]="schedule.stop_date"
|
||||
bs-datepicker data-date-format="yyyy-MM-dd" data-timezone="UTC"
|
||||
[(ngModel)]="schedule.stop_date" [textMask]="{mask: dateMask}"
|
||||
placeholder="Schedule stop date">
|
||||
</div>
|
||||
</div>
|
||||
@ -78,6 +76,8 @@ export class ScheduleFormComponent implements AfterViewChecked {
|
||||
@Output() onValid: EventEmitter<boolean> = new EventEmitter<boolean>();
|
||||
@ViewChild('form') form: NgForm;
|
||||
|
||||
dateMask = ['2', '0', /\d/, /\d/, '-', /[0-1]/, /\d/, '-', /[0-3]/, /\d/];
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
|
Loading…
Reference in New Issue
Block a user