I know this has already been answered, but I stumbled across this question and went down the path of using format
, which works, but it returns them as strings when I wanted integers.
I just realized that moment comes with date
, month
and year
methods that return the actual integers for each method.
moment().date()
moment().month() // jan=0, dec=11
moment().year()