How to get the meridian (am / pm) with momentsjs and angularjs

I would like could help me, I have a question to the library moments.js, I have an application in angularjs where I have six select, for the year, for the month, for day, for the hour, for minutes and one for the am / pm format, use the following format moment to build m.format date ('YYYY-MM-DD hh: mm: ss a),
the code is as follows:

The .hours() function and the input array passed to the moment constructor both expect hours of a 24-hour clock, from 0 to 23. There is no built-in function to accept or output a 12-hour clock value, or a meridiem (am/pm).

The parsing and formatting functions in moment do have options for 12-hour clock hours (h or hh) and meridiem (A or a), but you're not parsing or formatting in your use case, so they would be a bit clumsy to use. In particular, they are based on moment's current locale settings, so testing a string would be problematic if the locale wasn't fixed to a specific language.

You can use these simple functions to convert from 12-hour + meridiem to 24-hour and vice-versa. They are not specific to moment, so you can also use them with the Date object or elsewhere.

Also, be careful when calling .month() to get the month number, the results are 0-11, not 1-12. The same is true when building the input array. Your dropdown either needs to use 0-11, or you need to add or subtract 1 accordingly.

Email codedump link for How to get the meridian (am / pm) with momentsjs and angularjs