There are two potential problems.
First, if you run just the parsing on its own (like at the command-line REPL, you get the following warning.
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release.
So, that might not be the best string to parse, depending on your version.
But also, .day()
gives you a day of the week index. February 5th was a Wednesday, and since Moment is counting days from Sunday, that's almost certainly the right answer. If you want the day of the month (5), that's .date()
, instead.
Actually, there's a third potential problem, in that "02" and "05" make for an ambiguous date, so you probably want to feed Moment a parse string, a second parameter that looks something like "MM.DD.YYYY hh:mm:ss"
.