I'm using Moment.js to display time and dates on a site I am working on.
I have a Weather Module that displays TODAY, but I also want to display the forecast for 3 Days forward. I can use Moment.js to get Tomorrow, Tomorrow + 1 and Tomorrow + 2, but I don't know how to change their format so that it reads "WED, THU, FRI". Here's what I have currently:
var today = moment().format('MMMM D, YYYY');
var d1 = moment().add(1, 'days').calendar().format('ddd');
var d2 = moment().add(2, 'days').calendar().format('ddd');
var d3 = moment().add(3, 'days').calendar().format('ddd');
The error I get is that moment(...).add(...).calendar(...).format
is not a funtion. If I use THIS coode:
var d1 = moment().add(1, 'days');
and then console.log()
that variable, I can SEE:
M {_isAMomentObject: true, _isUTC: false, _pf: {…}, _locale: P, _d: Thu Nov 28 2019 08:51:46 GMT-0600 (Central Standard Time), …}
So I KNOW it's available, I just don't know the proper syntax to display the three character label for the day of the week.