convert military time to standard time javascript

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js"></script>function convert(input) {
    return moment(input, 'HH:mm:ss').format('h:mm:ss A');
}

console.log(convert('20:00:00'));
console.log(convert('08:00:00'));
console.log(convert('16:30:00'));