dev #14607 Море. Правки по сайту: fix mask

This commit is contained in:
nikolay 2023-07-05 14:50:43 +04:00
parent c1219e1637
commit 73de9ea6b7
2 changed files with 5 additions and 4 deletions

View File

@ -20,7 +20,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<mat-label>Дата рождения</mat-label> <mat-label>Дата рождения</mat-label>
<input formControlName="date" matInput [textMask]="mask"> <input formControlName="date" matInput [textMask]="mask" type="text" inputmode="numeric">
</mat-form-field> </mat-form-field>
<button mat-raised-button color="primary">Зарегистрироваться</button> <button mat-raised-button color="primary">Зарегистрироваться</button>
</div> </div>

View File

@ -18,8 +18,8 @@ export class CreateUserComponent implements OnInit {
public mask = { public mask = {
guide: true, guide: true,
showMask: false, showMask: true,
mask: [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/] mask: [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/]
}; };
constructor( constructor(
@ -31,6 +31,7 @@ export class CreateUserComponent implements OnInit {
submit() { submit() {
if (this.form.invalid) { if (this.form.invalid) {
this.messageService.clear();
this.messageService.add({ this.messageService.add({
severity: 'error', severity: 'error',
summary: 'Введите имя, пол и дату рождения', summary: 'Введите имя, пол и дату рождения',
@ -42,7 +43,7 @@ export class CreateUserComponent implements OnInit {
const sex = this.form.value.sex!; const sex = this.form.value.sex!;
const date = this.form.value.date!; const date = this.form.value.date!;
const formattedDate = moment(date).format('yyyy-MM-DD'); const formattedDate = moment(date, 'DD-MM-YYYY').format('yyyy-MM-DD');
this.authService.register(name, sex, formattedDate); this.authService.register(name, sex, formattedDate);
} }