dist/js/datepicker.js
function (date, ampm) {
            var d = date,
                hours = date;

            if (date instanceof Date) {
                d = dp.getParsedDate(date);
                hours = d.hours;
            }

            var _ampm = ampm || this.d.ampm,
                dayPeriod = 'am';

            if (_ampm) {
                switch(true) {
                    case hours == 0:
                        hours = 12;
                        break;
                    case hours == 12:
                        dayPeriod = 'pm';
                        break;
                    case hours > 11:
                        hours = hours - 12;
                        dayPeriod = 'pm';
                        break;
                    default:
                        break;
                }
            }

            return {
                hours: hours,
                dayPeriod: dayPeriod
            }
        }
function (date, ampm) {
            var d = date,
                hours = date;

            if (date instanceof Date) {
                d = dp.getParsedDate(date);
                hours = d.hours;
            }

            var _ampm = ampm || this.d.ampm,
                dayPeriod = 'am';

            if (_ampm) {
                switch(true) {
                    case hours == 0:
                        hours = 12;
                        break;
                    case hours == 12:
                        dayPeriod = 'pm';
                        break;
                    case hours > 11:
                        hours = hours - 12;
                        dayPeriod = 'pm';
                        break;
                    default:
                        break;
                }
            }

            return {
                hours: hours,
                dayPeriod: dayPeriod
            }
        }
function ( date , ampm ) { var d = date , hours = date ; if ( date instanceof Date ) { d = dp . getParsedDate ( date ) ; hours = d . hours ; } var _ampm = ampm || this . d . ampm , dayPeriod = 'am' ; if ( _ampm ) { switch ( true ) { case hours == 0 : hours = 12 ; break ; case hours == 12 : dayPeriod = 'pm' ; break ; case hours > 11 : hours = hours - 12 ; dayPeriod = 'pm' ; break ; default : break ; } } return { hours : hours , dayPeriod : dayPeriod } }
Calculates valid hour value to display in text input and datepicker's body.
@param date {Date|Number} - date or hours
@param [ampm] {Boolean} - 12 hours mode
@returns {{hours: *, dayPeriod: string}}
@private
Calculates valid hour value to display in text input and datepicker s body .