假设我有一个日期字符串,例如:
const currentTime = "2020-08-31T00:00:00Z"
我希望能够找到下一个季度的开始时间,同时保留日历日,或者直观地调整是否是该月的最后一天。预计时间:
const nextTime = "2020-09-30T00:00:00Z"
最佳答案
这将给出当前季度的数字
const current_quarter= moment().quarter();
这将为您提供下季度的开始日期
const start = moment().quarter(current_quarter+1).startOf('quarter');
您始终可以使用获取当前日期和时间
const today = moment();
关于javascript - MomentJS - 设置下季度开始的时间,同时保留相同/比较日历日?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61553682/