matheo / angular

Open Source Angular Libraries: MatDataSource, MatDatepicker
http://matheo.co/demos/
MIT License
60 stars 15 forks source link

Hour formatting is without '0' in front of the hour #56

Open davideas opened 2 years ago

davideas commented 2 years ago

Bug description

DatePicker for TimeView when type="time"

In the class MatCalendarHeader in updateValues() the formatting for the hour is ignoring the double digit: it doesn't display the 0 in front of the hour! this._hourButtonText = hours.toString(); --> any hour < 10 has only 1 digit

Expected behavior

Hour button text should have 0 for hour < 10, example => 06 instead of 6. Could you please fix it as you do for the minutes? like this: this._hourButtonText = ('00' + hours).slice(-2);

Screenshots

image