dev #14607 Море. Правки по сайту: fix mask
This commit is contained in:
parent
c1219e1637
commit
73de9ea6b7
@ -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>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user