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