在moment js中获取当前月份和年份

Get the current month and year in moment js

我想获取 moment.js 当前的月份和年份,例如:2020 年 9 月

我试过 moment(),它只用数字显示球洞日期

您需要传入正确的格式参数才能得到想要的结果。请点击这里了解更多详情https://momentjs.com/docs/#/displaying/

对于你的情况,试试这个

let check = moment("2020/09/25", "YYYY/MM/DD");
console.log(check.format("MMMM-YYYY"));
<script src="https://momentjs.com/downloads/moment.js"></script>