Add month wrong date
Dejmek opened this issue · 2 comments
Dejmek commented
Sometimes changing month returns wrong date. It happens only if current date is first day in month.
moment.format("iYYYY/iMM/iDD"); // "1438/05/01"
moment.iMonth(5);
moment.format("iYYYY/iMM/iDD"); // "1438/06/29"
Next same event is in 1441
ronrother commented
Also happens when calling "endOf('iMonth')".
antikh commented
Also when subtracting month
const moment = require("moment-hijri");
moment.locale('en-EN')
const today = moment("2018-03-29");
console.log("Today:", today.format("iDD/iMM/iYYYY")); // Today: 12/07/1439
const monthAgo = today.add(-1, "iMonth");
console.log("Month ago:", monthAgo.format("iDD/iMM/iYYYY")); // Month ago: 11/07/1439
Seems that happens with non leap years