daya
daya

Reputation: 1

How to find the day of month in momentjs

how can i find the day of the month that current moment date points to. like over here iam trying to invoke dayOfMonth()

 var compareDay = function(ts1,ts2){
           return (moment(ts1).dayOfMonth() === moment(ts2).dayOfMonth())?true:false;
 };

Upvotes: 0

Views: 2327

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201439

Per the documentation,

Moment#date is for the date of the month, and Moment#day is for the day of the week.

So I believe you want,

return moment(ts1).date() === moment(ts2).date();

Upvotes: 2

Related Questions