Reputation: 13
I'm having a problem with momentjs. I'm trying to generate all days from a specific month by using the startOf
and endOf
methods on my moment object like this:
moment('2017-07-17').startOf('month')
However, when I log the return value in the console it returns "2017-06-30T22:00:00.000Z"
.
I expect it to just be "2017-07-01T00:00:00.000Z"
.
I am using vue 2.x if that makes any difference, and I'm importing moment like import moment from 'moment';
.
Upvotes: 1
Views: 1122
Reputation: 4648
Its because of timezone moment('2017-07-17')
will take your local timezone which looks to be CEST.
instead do
moment.utc('2017-07-17')
Upvotes: 2