@@ -639,25 +639,33 @@ export class Timepicker extends Component<TimepickerOptions> {
639
639
if ( isHours ) {
640
640
const value = parseInt ( this . inputHours . value ) ;
641
641
if ( value > 0 && value < 13 ) {
642
- this . drawClockFromTimeInput ( value , isHours ) ;
643
642
this . hours = value ;
644
643
}
644
+ else if ( value == 0 ) {
645
+ this . hours = 12 ;
646
+ this . inputHours . value = this . hours . toString ( ) ;
647
+ }
645
648
else {
646
- const hour = new Date ( ) . getHours ( ) ;
647
- this . inputHours . value = ( hour % 12 ) . toString ( ) ;
649
+ this . hours = 1 ;
650
+ this . inputHours . value = this . hours . toString ( ) ;
648
651
}
652
+ this . drawClockFromTimeInput ( this . hours , isHours ) ;
649
653
}
650
654
else {
651
655
const value = parseInt ( this . inputMinutes . value ) ;
652
656
if ( value >= 0 && value < 60 ) {
653
- this . inputMinutes . value = String ( value ) ;
654
- this . drawClockFromTimeInput ( value , isHours ) ;
657
+ this . inputMinutes . value = Timepicker . _addLeadingZero ( value ) ;
655
658
this . minutes = value ;
656
659
}
660
+ else if ( value == - 1 ) {
661
+ this . minutes = 59 ;
662
+ this . inputMinutes . value = Timepicker . _addLeadingZero ( this . minutes . toString ( ) ) ;
663
+ }
657
664
else {
658
- const minutes = new Date ( ) . getMinutes ( ) ;
659
- this . inputMinutes . value = Timepicker . _addLeadingZero ( minutes ) ;
665
+ this . minutes = 0 ;
666
+ this . inputMinutes . value = Timepicker . _addLeadingZero ( this . minutes ) ;
660
667
}
668
+ this . drawClockFromTimeInput ( value , isHours ) ;
661
669
}
662
670
}
663
671
@@ -811,9 +819,9 @@ export class Timepicker extends Component<TimepickerOptions> {
811
819
<div class="timepicker-digital-display">
812
820
<div class="timepicker-text-container">
813
821
<div class="timepicker-display-column">
814
- <input type="number" maxlength="2" autofocus class="timepicker-input-hours text-primary" min="1" max="12" />
822
+ <input type="number" maxlength="2" autofocus class="timepicker-input-hours text-primary"/>
815
823
:
816
- <input type="number" maxlength="2" class="timepicker-input-minutes" min="0" max="59" />
824
+ <input type="number" maxlength="2" class="timepicker-input-minutes"/>
817
825
</div>
818
826
<div class="timepicker-display-column timepicker-display-am-pm">
819
827
<div class="timepicker-span-am-pm"></div>
0 commit comments