Skip to content

Commit

Permalink
feat(initForm): auto add 0 on initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Balet committed Mar 20, 2024
1 parent 97f50b8 commit 6a4038b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mat-birthday-input",
"version": "17.2.2",
"version": "17.3.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-mat-birthday-input/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mat-birthday-input",
"version": "17.2.2",
"version": "17.3.0",
"author": {
"name": "Raphaël Balet",
"email": "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ export class NgxMatBirthdayInputComponent
}

this.itemForm.patchValue({
day: day,
month: month,
day: this._addZero(day),
month: this._addZero(month),
year: year,
})
}
Expand Down Expand Up @@ -361,4 +361,9 @@ export class NgxMatBirthdayInputComponent
this._formerValues[target] = value
return true
}

private _addZero(number: string) {
if (number.length === 1) return '0' + number
return number
}
}

0 comments on commit 6a4038b

Please sign in to comment.