Добрый день, я генерирую 3 даты из строки, я надеюсь, что результат был:
billing date: 2020/01/11
cutoff start: 2019/11/11
cuttof end: 2019/12/10
, но я получаю следующее:
billing date: 2020/11/10
cutoff start: 2019/11/10
cuttof end: 2019/12/10
Я хотел бы знать как javascript работает с переменными или в чем проблема, поскольку все меняется
var month = "Jan-20"
var coverage_month_obj = moment(month, 'MMM-YY').toDate();
var billing_date = new Date(coverage_month_obj.setDate(coverage_month_obj.getDate() + 10))
var cutoff_end = new Date(billing_date.setMonth(billing_date.getMonth() - 1))
cutoff_end = new Date(billing_date.setDate(billing_date.getDate() - 1))
var cutoff_start = new Date(billing_date.setMonth(billing_date.getMonth() - 1))