What is the use of the following format, supported by Moment.js?
> const moment=require('moment')
undefined
> moment().format('h AM/PM')
'3 PM10/P10'
Particularly, what does PM10/P10 mean? From the docs here.
>Solution :
It’s parsing the string through its constituent pieces of the date time spec: https://en.wikipedia.org/wiki/ISO_8601
However the wiki it’s tricky to understand, so to breakdown what its returning:
The string h AM/PM breakdown as:
h(no zero) HourAAM / PM postfixMMonth/Pa text slash and letter PMMonth
Therefore splitting on the output string: 3 PM10/P10 looks like this:
h A M /P M
3 PM 10 /P 10
That said, you probably only want the h A as your format string – this cheat-sheet should help: https://devhints.io/moment
> const moment=require('moment')
undefined
> moment().format('h A')
'3 PM'