I'm having trouble to find the format for making like :
6 a.m.
I'm wondering if someone know which string i need to enter to outputFormat for make it the format as describe.
moment(openTime, inputFormat).format(outputFormat)
This format:
'a.m.'
I'm having trouble to find the format for making like :
6 a.m.
I'm wondering if someone know which string i need to enter to outputFormat for make it the format as describe.
moment(openTime, inputFormat).format(outputFormat)
This format:
'a.m.'
Moment.js doesn't have the exact format output you want, but you can produce it using two .replaces afterwards.
var m = moment();
var s = m.format('h a');
console.log(s);
s = s.replace('am', 'a.m.').replace('pm', 'p.m.');
console.log(s);
m = m.add(12, 'hours');
s = m.format('h a');
console.log(s);
s = s.replace('am', 'a.m.').replace('pm', 'p.m.');
console.log(s);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.28.0/moment.min.js"></script>