【发布时间】:2019-10-20 14:56:33
【问题描述】:
我们的应用程序生成的日志存在问题。解决方案是即使选择的日期在月中,我们也需要获取下个月的第一天。
尝试阅读 Moment 上的文档,但找不到任何可能的解决方案。
var currentDate = new Date();
var start_date = new Date(); //Wed Jun 05 2019 13:23:06 GMT+0800 (Philippine Standard Time)
console.log(start_date);
start_date.setDate(start_date.getDate() - 365); //1496640186958
console.log(start_date.setDate(start_date.getDate() - 365)); //Monday, June 5, 2017 1:23:06.958 PM GMT+08:00
// this output should be July 1, 2017, how can I get the first day of next month here?
start_date = customizeDate.formatDateToString(start_date);
var end_date = dateRange.endDate;
【问题讨论】: