Does any body know, any method provided by moment.js to get the days count that are passed till today (include current day too) for the current month.
Let say current days is: 05-03-2020 (dd-mm-yyyy)
let count_of_days = moment().getPassedDays()
console.log(count_of_days) // output 5
Some Solutions I tried:
1-
let count_of_days = moment().days() + 1
console.log(count_of_days) // 5
2-
let count_of_days = parseInt(moment().format("DD")) + 1
console.log(count_of_days) // 5
3-
let start_of_month = moment().startOf("month")
let curr_day_of_month = moment()
let count_of_days = start_of_month.diff(curr_day_of_month, "days") + 1
console.log(count_of_days) // 5
I think date() function return what you're looking for
console.log(moment().date()) // Return 5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With