Not sure why the following is returning false
. The format specified in the second argument is exactly what I've specified while initializing a Bootstrap Datetimepicker.
moment('Fri 5 Jan, 2018 - 05:00 PM', 'ddd d MMM, YYYY - hh:mm A').isValid()
I am trying to convert datetime in the first argument to YYYY-MM-DD HH:mm
format, but moment
keeps returning an Invalid Date error.
According to the documentation you should use a capital D for the day digit (5 Jan), whereas you now have a lowercase d.
moment('Fri 5 Jan, 2018 - 05:00 PM', 'ddd D MMM, YYYY - hh:mm A').isValid();