I have a Protractor test where I am making sure the date text in my element is equal to the current date. This doesn't always work because one value goes from UTC where the other grabs local timezone. How can I compare both these values to make sure they are the same date? Thanks.
var moment = require('moment');
var dateFormatted = moment().utcOffset(-420).format('MMM DD, YYYY'); // set to Arizona time
var dateInfo = element(by.css('.date'));
dateInfo.getText().then(function (dateText) {
var textFormatted = moment(dateText).utcOffset(-420).format('MMM DD, YYYY');
expect(textFormatted).toEqual(dateFormatted);
});