Skip to content

Commit

Permalink
refactor(updateItemForm): use padStart
Browse files Browse the repository at this point in the history
  • Loading branch information
rbalet committed Feb 6, 2025
1 parent 03acad6 commit b4cc65b
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ export class NgxMatBirthdayInputComponent
this.itemForm.patchValue({
minute: minute,
hour: hour,
day: this._addZero(day),
month: this._addZero(month),
day: day.padStart(2, '0'),
month: month.padStart(2, '0'),
year: year,
datePicker: date ? new Date(date) : new Date(),
})
Expand Down Expand Up @@ -420,9 +420,4 @@ 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 b4cc65b

Please sign in to comment.