javascript - Moment js Not returning the right day of the week -
i trying use momentjs return day of week (ex. "monday" or "mon", doesn't matter long it's name of day of week) string number stored in db (ex "3"
). reason keep getting monday returned.
var values = ["3", "06:00", "18:00"]; moment().isoweekday(values[0]).format('ddd'); //returns "mon"
i've tried using moment('3','d').format('ddd')
i've tried using moment().days('3').format('ddd')
returns same day. sat or mon.
try
moment().isoweekday(parseint(values[0])).format('ddd');
and in general, store week day integer , not string:
var values = [3, "06:00", "18:00"];
Comments
Post a Comment