You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Formatting date today

Received Response
39
Views
3
Comments
edited Apr 16, 2020 10:10PM in Visual Builder 3 comments

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;
});

 

 

 

 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!