Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/clockpicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@
line-height: 30px;
text-align: center;
}
.clockpicker-popover .popover-title span {
.clockpicker-popover .clockpicker-span-hours,
.clockpicker-popover .clockpicker-span-minutes {
cursor: pointer;
}
.clockpicker-popover .clockpicker-span-am-pm {
padding: 0 0 0 10px;
}
.clockpicker-popover .popover-content {
background-color: #f8f8f8;
padding: 12px;
Expand Down
13 changes: 12 additions & 1 deletion src/clockpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@
this.spanHours.html(leadingZero(this.hours));
this.spanMinutes.html(leadingZero(this.minutes));

if (this.hours < 12) this.amOrPm = 'AM';

// Toggle to hours view
this.toggleView('hours');

Expand All @@ -487,7 +489,7 @@

// Hide when ESC is pressed
$doc.on('keyup.clockpicker.' + this.id, function(e){
if (e.keyCode === 27) {
if (e.keyCode === 27 || e.keyCode === 13) {
self.hide();
}
});
Expand Down Expand Up @@ -526,6 +528,15 @@
this.spanHours.toggleClass('text-primary', isHours);
this.spanMinutes.toggleClass('text-primary', ! isHours);

// Select AM/PM
if (this.options.twelvehour) {
if (this.amOrPm === 'AM') {
this.amPmBlock.find('.am-button').trigger('click');
} else {
this.amPmBlock.find('.pm-button').trigger('click');
}
}

// Let's make transitions
hideView.addClass('clockpicker-dial-out');
nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
Expand Down