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

View File

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