How do I get the correct month number in moment js?

const now = new Date();
const formatedDateAppend = moment(now).format('D-M-YYYY');
console.log(formatedDateAppend);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.js"></script>

It's October now. But instead of 4.9.2018, it outputs 4.10.2018.

How can I make the month number start with 1 instead of 0?

Author: nörbörnën, 2018-10-04

1 answers

Https://momentjs.com/docs/

M MM 1..12 Month number

Just the 10th month of October.

 3
Author: nilecrocodile, 2018-10-04 13:39:48