Formatting date today
Content
Hi,
Can anyone tell me if there is anything wrong with my JS code?
I am trying to use format today date but I've noticed the first function is not giving an output.
define([], function () {
'use strict';
var PageModule = function PageModule() {};
PageModule.prototype.today= function() {
return new Date();
};
PageModule.prototype.getTodaysDate = function(inputDate) {
var newDate = new Date();
return newDate.toISOString();
};
PageModule.prototype.DateFormatConverter = function(inputDate) {
if(inputDate){
var dateArray = inputDate.split("-");
var day = dateArray[2].slice(-2);
var year = dateArray[0].slice(2,4);
var month = dateArray[1].slice(-2);
var outputDate = day+ month + year ;
return outputDate;
}
return "";
};
return PageModule;
});